diff --git a/sdk/keyvault/azure-keyvault-administration/CHANGELOG.md b/sdk/keyvault/azure-keyvault-administration/CHANGELOG.md index 2e303165395e..1aef9269881d 100644 --- a/sdk/keyvault/azure-keyvault-administration/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-administration/CHANGELOG.md @@ -10,7 +10,7 @@ ### Other Changes - Updated minimum `azure-core` version to 1.24.0 -- Updated minimum `msrest` version to 0.7.1 +- Dropped `msrest` requirement ## 4.2.0 (2022-09-19) diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/__init__.py index a6c1f9b7a792..f81543eeed02 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_configuration.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_configuration.py index 4a4fcbedaa26..ab14ad694f07 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_configuration.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_configuration.py @@ -8,17 +8,13 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any 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 - class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_key_vault_client.py index 8cc95019e296..9cc307ef72a7 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_key_vault_client.py @@ -9,9 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Optional from azure.core import PipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -19,10 +17,7 @@ from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional +from ._serialization import Deserializer, Serializer class _SDKClient(object): def __init__(self, *args, **kwargs): diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_operations_mixin.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_operations_mixin.py index 4a652a9878e7..15767ddccd90 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_operations_mixin.py @@ -8,34 +8,35 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import TYPE_CHECKING +from ._serialization import Serializer, Deserializer +from typing import Any, IO, Optional, Union -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional +from azure.core.polling import LROPoller - from azure.core.polling import LROPoller +from . import models as _models class KeyVaultClientOperationsMixin(object): def begin_full_backup( self, - vault_base_url, # type: str - azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FullBackupOperation"] + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid - for at least next 24 hours from the time of making this call. Default value is None. - :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -47,7 +48,7 @@ def begin_full_backup( :return: An instance of LROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_full_backup') if api_version == '7.2': @@ -66,19 +67,21 @@ def begin_full_backup( def begin_full_restore_operation( self, - vault_base_url, # type: str - restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestoreOperation"] + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous - successful full backup was stored. Default value is None. - :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -90,7 +93,7 @@ def begin_full_restore_operation( :return: An instance of LROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_full_restore_operation') if api_version == '7.2': @@ -109,22 +112,25 @@ def begin_full_restore_operation( def begin_selective_key_restore_operation( self, - vault_base_url, # type: str - key_name, # type: str - restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SelectiveKeyRestoreOperation"] + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous - successful full backup was stored. Default value is None. + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -136,7 +142,7 @@ def begin_selective_key_restore_operation( :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_selective_key_restore_operation') if api_version == '7.2': @@ -155,21 +161,20 @@ def begin_selective_key_restore_operation( def full_backup_status( self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FullBackupOperation" + vault_base_url: str, + job_id: str, + **kwargs: Any + ) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('full_backup_status') if api_version == '7.2': @@ -188,21 +193,20 @@ def full_backup_status( def restore_status( self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreOperation" + vault_base_url: str, + job_id: str, + **kwargs: Any + ) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_status') if api_version == '7.2': diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_serialization.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_serialization.py new file mode 100644 index 000000000000..240df16c57f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, 'read'): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding='utf-8-sig') + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if 'content-type' in headers: + content_type = headers['content-type'].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds()/3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + +try: + from datetime import timezone + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0 + } + + def __init__(self, classes=None): + self.serialize_type = { + 'iso-8601': Serializer.serialize_iso, + 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, + 'duration': Serializer.serialize_duration, + 'date': Serializer.serialize_date, + 'time': Serializer.serialize_time, + 'decimal': Serializer.serialize_decimal, + 'long': Serializer.serialize_long, + 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, + 'object': self.serialize_object, + '[]': self.serialize_iter, + '{}': self.serialize_dict + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data( + target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data( + target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == '': + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) + + + if is_xml_model_serialization: + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + xml_prefix = xml_desc.get('prefix', None) + xml_ns = xml_desc.get('ns', None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if 'name' not in getattr(orig_attr, '_xml_map', {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node( + xml_name, + xml_prefix, + xml_ns + ) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format( + attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip('[]{}') + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback( + SerializationError, "Unable to build a model: "+str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [ + self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" + for d + in data + ] + if not kwargs.get('skip_quote', False): + data = [ + quote(str(d), safe='') + for d + in data + ] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ['[str]']: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type]( + data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback( + SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == 'str': + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ['' if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if 'xml' in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get('xml', {}) + xml_name = xml_desc.get('name') + if not xml_name: + xml_name = serialization_ctxt['key'] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node( + node_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data( + value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if 'xml' in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt['xml'] + xml_name = xml_desc['name'] + + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object( + value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object( + obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode('ascii') + return encoded.strip('=').replace('+', '-').replace('/', '_') + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], utc.tm_mday, + Serializer.months[utc.tm_mon], utc.tm_year, + utc.tm_hour, utc.tm_min, utc.tm_sec) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + if microseconds: + microseconds = '.'+microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + microseconds + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + return working_data.get(key) + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + + # Look for a children + is_iter_type = attr_desc['type'].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + )) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + + valid_date = re.compile( + r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' + r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + + def __init__(self, classes=None): + self.deserialize_type = { + 'iso-8601': Deserializer.deserialize_iso, + 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, + 'duration': Deserializer.deserialize_duration, + 'date': Deserializer.deserialize_date, + 'time': Deserializer.deserialize_time, + 'decimal': Deserializer.deserialize_decimal, + 'long': Deserializer.deserialize_long, + 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, + 'object': self.deserialize_object, + '[]': self.deserialize_iter, + '{}': self.deserialize_dict + } + self.deserialize_expected_types = { + 'duration': (isodate.Duration, datetime.timedelta), + 'iso-8601': (datetime.datetime) + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [ + rest_key_extractor, + xml_key_extractor + ] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, '_validation', {}).items() + if config.get('constant')] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig['type'] + internal_data_type = local_type.strip('[]{}') + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr( + data, + attr, + self._deserialize(local_type, value) + ) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == '': + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip('[]{}') + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ("Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning( + msg, + found_value, + key_extractor, + attr + ) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc['type']) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) + for desc in attribute_map.values() if desc['key'] != ''} + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + #Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text(), + raw_data.headers + ) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, '_content_consumed'): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text, + raw_data.headers + ) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, '_subtype_map', {}) + try: + readonly = [k for k, v in response._validation.items() + if v.get('readonly')] + const = [k for k, v in response._validation.items() + if v.get('constant')] + kwargs = {k: v for k, v in attrs.items() + if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format( + kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( + iter_type, + type(attr) + )) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, 'str') + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object( + value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object( + obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return '' + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == 'bool': + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ['true', '1']: + return True + elif attr.lower() in ['false', '0']: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == 'str': + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], + tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split('.') + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_key_vault_client.py index 950a22a02cac..3aa269a92bad 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_key_vault_client.py @@ -11,12 +11,11 @@ from typing import Any, Optional -from msrest import Deserializer, Serializer - from azure.core import AsyncPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_operations_mixin.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_operations_mixin.py index 11c762cd1af8..4502b4f082cd 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_operations_mixin.py @@ -8,29 +8,35 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import Any, Optional +from .._serialization import Serializer, Deserializer +from typing import Any, IO, Optional, Union from azure.core.polling import AsyncLROPoller +from .. import models as _models + class KeyVaultClientOperationsMixin(object): async def begin_full_backup( self, vault_base_url: str, - azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.FullBackupOperation"]: + ) -> AsyncLROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid - for at least next 24 hours from the time of making this call. Default value is None. - :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -42,7 +48,7 @@ async def begin_full_backup( :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_full_backup') if api_version == '7.2': @@ -62,17 +68,20 @@ async def begin_full_backup( async def begin_full_restore_operation( self, vault_base_url: str, - restore_blob_details: Optional["_models.RestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.RestoreOperation"]: + ) -> AsyncLROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous - successful full backup was stored. Default value is None. - :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -84,7 +93,7 @@ async def begin_full_restore_operation( :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_full_restore_operation') if api_version == '7.2': @@ -105,19 +114,23 @@ async def begin_selective_key_restore_operation( self, vault_base_url: str, key_name: str, - restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.SelectiveKeyRestoreOperation"]: + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous - successful full backup was stored. Default value is None. + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -130,7 +143,7 @@ async def begin_selective_key_restore_operation( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_selective_key_restore_operation') if api_version == '7.2': @@ -152,17 +165,17 @@ async def full_backup_status( vault_base_url: str, job_id: str, **kwargs: Any - ) -> "_models.FullBackupOperation": + ) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('full_backup_status') if api_version == '7.2': @@ -184,17 +197,17 @@ async def restore_status( vault_base_url: str, job_id: str, **kwargs: Any - ) -> "_models.RestoreOperation": + ) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_status') if api_version == '7.2': diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_configuration.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_configuration.py index 457e46a57cde..7bb2d3edc7bc 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_configuration.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_configuration.py @@ -6,17 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any 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): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. @@ -28,30 +25,24 @@ class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-in :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str - + api_version = kwargs.pop("api_version", "7.2") # type: str self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**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-administration/azure/keyvault/administration/_generated/v7_2/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_key_vault_client.py index 2e9f31179ff0..f3b94fe2976f 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_key_vault_client.py @@ -7,23 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin, RoleAssignmentsOperations, RoleDefinitionsOperations -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -38,29 +33,23 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): Retry-After header is present. """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None - _base_url = '{vaultBaseUrl}' + def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential + _endpoint = "{vaultBaseUrl}" self._config = KeyVaultClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.role_definitions = RoleDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.role_assignments = RoleAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + self.role_definitions = RoleDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.role_assignments = RoleAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -69,7 +58,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_metadata.json b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_metadata.json index 30c0ec6f41e4..7ea5074adef3 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_metadata.json +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": false, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.core\": [\"PipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.core\": [\"AsyncPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}}" }, "global_parameters": { "sync": { @@ -65,104 +65,112 @@ "role_assignments": "RoleAssignmentsOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"LROPoller\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"AsyncLROPoller\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.polling\": [\"LROPoller\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.polling\": [\"AsyncLROPoller\"]}}}", "operations": { "_full_backup_initial" : { "sync": { - "signature": "def _full_backup_initial(\n self,\n vault_base_url, # type: str\n azure_storage_blob_container_uri=None, # type: Optional[\"_models.SASTokenParameter\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.FullBackupOperation\"\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[\"_models.SASTokenParameter\"] = None,\n **kwargs: Any\n) -\u003e \"_models.FullBackupOperation\":\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, azure_storage_blob_container_uri" + "signature": "async def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" + } }, "begin_full_backup" : { "sync": { - "signature": "def begin_full_backup(\n self,\n vault_base_url, # type: str\n azure_storage_blob_container_uri=None, # type: Optional[\"_models.SASTokenParameter\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.FullBackupOperation\"]\n", - "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.FullBackupOperation]:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[\"_models.SASTokenParameter\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.FullBackupOperation\"]:\n", - "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.FullBackupOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, azure_storage_blob_container_uri" + "signature": "async def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.FullBackupOperation]:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.FullBackupOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" + } }, "full_backup_status" : { "sync": { - "signature": "def full_backup_status(\n self,\n vault_base_url, # type: str\n job_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.FullBackupOperation\"\n", - "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" }, "async": { "coroutine": true, - "signature": "async def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e \"_models.FullBackupOperation\":\n", - "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, job_id" + "signature": "async def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" + } }, "_full_restore_operation_initial" : { "sync": { - "signature": "def _full_restore_operation_initial(\n self,\n vault_base_url, # type: str\n restore_blob_details=None, # type: Optional[\"_models.RestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.RestoreOperation\"\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[\"_models.RestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e \"_models.RestoreOperation\":\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, restore_blob_details" + "signature": "async def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" + } }, "begin_full_restore_operation" : { "sync": { - "signature": "def begin_full_restore_operation(\n self,\n vault_base_url, # type: str\n restore_blob_details=None, # type: Optional[\"_models.RestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.RestoreOperation\"]\n", - "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.RestoreOperation]:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[\"_models.RestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.RestoreOperation\"]:\n", - "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.RestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, restore_blob_details" + "signature": "async def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.RestoreOperation]:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.RestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" + } }, "restore_status" : { "sync": { - "signature": "def restore_status(\n self,\n vault_base_url, # type: str\n job_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.RestoreOperation\"\n", - "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e \"_models.RestoreOperation\":\n", - "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, job_id" + "signature": "async def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" + } }, "_selective_key_restore_operation_initial" : { "sync": { - "signature": "def _selective_key_restore_operation_initial(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n restore_blob_details=None, # type: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SelectiveKeyRestoreOperation\"\n", - "doc": "\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.SelectiveKeyRestoreOperation:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SelectiveKeyRestoreOperation\":\n", - "doc": "\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, restore_blob_details" + "signature": "async def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.SelectiveKeyRestoreOperation:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" + } }, "begin_selective_key_restore_operation" : { "sync": { - "signature": "def begin_selective_key_restore_operation(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n restore_blob_details=None, # type: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.SelectiveKeyRestoreOperation\"]\n", - "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.SelectiveKeyRestoreOperation]:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.SelectiveKeyRestoreOperation\"]:\n", - "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, restore_blob_details" + "signature": "async def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.SelectiveKeyRestoreOperation]:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_patch.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_vendor.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_vendor.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_configuration.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_configuration.py index d7d9c414df27..5da14e4288f3 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_configuration.py @@ -13,6 +13,7 @@ VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. @@ -24,28 +25,21 @@ class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-in :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str - + api_version = kwargs.pop("api_version", "7.2") # type: str self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**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-administration/azure/keyvault/administration/_generated/v7_2/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_key_vault_client.py index 67f68da0ae8c..17b901ce4ab0 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_key_vault_client.py @@ -9,16 +9,16 @@ from copy import deepcopy from typing import Any, Awaitable -from msrest import Deserializer, Serializer - from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin, RoleAssignmentsOperations, RoleDefinitionsOperations -class KeyVaultClient(KeyVaultClientOperationsMixin): + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -33,27 +33,23 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): Retry-After header is present. """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' + def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential + _endpoint = "{vaultBaseUrl}" self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.role_definitions = RoleDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.role_assignments = RoleAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.role_definitions = RoleDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.role_assignments = RoleAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -62,7 +58,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_vendor.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/__init__.py index f871fcce6e3a..c53e46e634a2 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/__init__.py @@ -10,8 +10,14 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'RoleDefinitionsOperations', - 'RoleAssignmentsOperations', - 'KeyVaultClientOperationsMixin', + "RoleDefinitionsOperations", + "RoleAssignmentsOperations", + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_key_vault_client_operations.py index ca1e445c05c6..eb1cd64766ef 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_key_vault_client_operations.py @@ -6,97 +6,134 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.polling.async_base_polling import AsyncLROBasePolling from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_full_backup_request_initial, build_full_backup_status_request, build_full_restore_operation_request_initial, build_restore_status_request, build_selective_key_restore_operation_request_initial -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_full_backup_request, + build_full_backup_status_request, + build_full_restore_operation_request, + build_restore_status_request, + build_selective_key_restore_operation_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: +class KeyVaultClientOperationsMixin(MixinABC): async def _full_backup_initial( self, vault_base_url: str, - azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, **kwargs: Any - ) -> "_models.FullBackupOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] + ) -> _models.FullBackupOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - if azure_storage_blob_container_uri is not None: - _json = self._serialize.body(azure_storage_blob_container_uri, 'SASTokenParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(azure_storage_blob_container_uri, (IO, bytes)): + _content = azure_storage_blob_container_uri else: - _json = None + if azure_storage_blob_container_uri is not None: + _json = self._serialize.body(azure_storage_blob_container_uri, "SASTokenParameter") + else: + _json = None - request = build_full_backup_request_initial( + request = build_full_backup_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_backup_initial.metadata['url'], + content=_content, + template_url=self._full_backup_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_backup_initial.metadata = {'url': "/backup"} # type: ignore - + _full_backup_initial.metadata = {"url": "/backup"} # type: ignore - @distributed_trace_async + @overload async def begin_full_backup( self, vault_base_url: str, - azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None, + azure_storage_blob_container_uri: Optional[_models.SASTokenParameter] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.FullBackupOperation"]: + ) -> AsyncLROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call. Default value is None. :type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -108,101 +145,185 @@ async def begin_full_backup( :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Default value is None. + :type azure_storage_blob_container_uri: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._full_backup_initial( + raw_result = await self._full_backup_initial( # type: ignore vault_base_url=vault_base_url, azure_storage_blob_container_uri=azure_storage_blob_container_uri, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_backup.metadata = {'url': "/backup"} # type: ignore + begin_full_backup.metadata = {"url": "/backup"} # type: ignore @distributed_trace_async - async def full_backup_status( - self, - vault_base_url: str, - job_id: str, - **kwargs: Any - ) -> "_models.FullBackupOperation": + async def full_backup_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - request = build_full_backup_status_request( job_id=job_id, api_version=api_version, - template_url=self.full_backup_status.metadata['url'], + template_url=self.full_backup_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,88 +331,108 @@ async def full_backup_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - full_backup_status.metadata = {'url': "/backup/{jobId}/pending"} # type: ignore - + full_backup_status.metadata = {"url": "/backup/{jobId}/pending"} # type: ignore async def _full_restore_operation_initial( self, vault_base_url: str, - restore_blob_details: Optional["_models.RestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> "_models.RestoreOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] + ) -> _models.RestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'RestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "RestoreOperationParameters") + else: + _json = None - request = build_full_restore_operation_request_initial( + request = build_full_restore_operation_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._full_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_restore_operation_initial.metadata = {'url': "/restore"} # type: ignore - + _full_restore_operation_initial.metadata = {"url": "/restore"} # type: ignore - @distributed_trace_async + @overload async def begin_full_restore_operation( self, vault_base_url: str, - restore_blob_details: Optional["_models.RestoreOperationParameters"] = None, + restore_blob_details: Optional[_models.RestoreOperationParameters] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RestoreOperation"]: + ) -> AsyncLROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -303,101 +444,182 @@ async def begin_full_restore_operation( :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._full_restore_operation_initial( + raw_result = await self._full_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('RestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_restore_operation.metadata = {'url': "/restore"} # type: ignore + begin_full_restore_operation.metadata = {"url": "/restore"} # type: ignore @distributed_trace_async - async def restore_status( - self, - vault_base_url: str, - job_id: str, - **kwargs: Any - ) -> "_models.RestoreOperation": + async def restore_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] - request = build_restore_status_request( job_id=job_id, api_version=api_version, - template_url=self.restore_status.metadata['url'], + template_url=self.restore_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,93 +627,188 @@ async def restore_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_status.metadata = {'url': "/restore/{jobId}/pending"} # type: ignore - + restore_status.metadata = {"url": "/restore/{jobId}/pending"} # type: ignore async def _selective_key_restore_operation_initial( self, vault_base_url: str, key_name: str, - restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> "_models.SelectiveKeyRestoreOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] + ) -> _models.SelectiveKeyRestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'SelectiveKeyRestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "SelectiveKeyRestoreOperationParameters") + else: + _json = None - request = build_selective_key_restore_operation_request_initial( + request = build_selective_key_restore_operation_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._selective_key_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._selective_key_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _selective_key_restore_operation_initial.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + _selective_key_restore_operation_initial.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore + @overload + async def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[_models.SelectiveKeyRestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. - @distributed_trace_async + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload async def begin_selective_key_restore_operation( self, vault_base_url: str, key_name: str, - restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.SelectiveKeyRestoreOperation"]: + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -504,55 +821,69 @@ async def begin_selective_key_restore_operation( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._selective_key_restore_operation_initial( + raw_result = await self._selective_key_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, key_name=key_name, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_selective_key_restore_operation.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + begin_selective_key_restore_operation.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_assignments_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_assignments_operations.py index 61034bd07aa1..72bb47c6f8ff 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_assignments_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_assignments_operations.py @@ -6,22 +6,39 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._role_assignments_operations import build_create_request, build_delete_request, build_get_request, build_list_for_scope_request -T = TypeVar('T') +from ...operations._role_assignments_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_for_scope_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RoleAssignmentsOperations: """ .. warning:: @@ -35,60 +52,61 @@ class RoleAssignmentsOperations: models = _models def __init__(self, *args, **kwargs) -> None: - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def delete( - self, - vault_base_url: str, - scope: str, - role_assignment_name: str, - **kwargs: Any - ) -> "_models.RoleAssignment": + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Deletes a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to delete. + :param scope: The scope of the role assignment to delete. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to delete. + :param role_assignment_name: The name of the role assignment to delete. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_delete_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,15 +114,76 @@ async def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + + @overload + async def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: _models.RoleAssignmentCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create( @@ -112,35 +191,51 @@ async def create( vault_base_url: str, scope: str, role_assignment_name: str, - parameters: "_models.RoleAssignmentCreateParameters", + parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any - ) -> "_models.RoleAssignment": + ) -> _models.RoleAssignment: """Creates a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to create. + :param scope: The scope of the role assignment to create. Required. :type scope: str :param role_assignment_name: The name of the role assignment to create. It can be any valid - GUID. + GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. - :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters + :param parameters: Parameters for the role assignment. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - _json = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") request = build_create_request( scope=scope, @@ -148,19 +243,21 @@ async def create( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create.metadata['url'], + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -168,63 +265,64 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace_async async def get( - self, - vault_base_url: str, - scope: str, - role_assignment_name: str, - **kwargs: Any - ) -> "_models.RoleAssignment": + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Get the specified role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment. + :param scope: The scope of the role assignment. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to get. + :param role_assignment_name: The name of the role assignment to get. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_get_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,80 +330,76 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace def list_for_scope( - self, - vault_base_url: str, - scope: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignmentListResult"]: + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.RoleAssignment"]: """Gets role assignments for a scope. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignments. + :param scope: The scope of the role assignments. Required. :type scope: str :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.RoleAssignmentListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleAssignment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.RoleAssignment] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignmentListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_for_scope_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list_for_scope.metadata['url'], + api_version=api_version, + template_url=self.list_for_scope.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -319,10 +413,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -333,8 +425,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_for_scope.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_definitions_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_definitions_operations.py index 86b780a24818..ba4f46904c36 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_definitions_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/aio/operations/_role_definitions_operations.py @@ -6,22 +6,39 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._role_definitions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._role_definitions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RoleDefinitionsOperations: """ .. warning:: @@ -35,60 +52,62 @@ class RoleDefinitionsOperations: models = _models def __init__(self, *args, **kwargs) -> None: - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def delete( - self, - vault_base_url: str, - scope: str, - role_definition_name: str, - **kwargs: Any - ) -> "_models.RoleDefinition": + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Deletes a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to delete. Managed HSM only supports '/'. + Required. :type scope: str - :param role_definition_name: The name (GUID) of the role definition to delete. + :param role_definition_name: The name (GUID) of the role definition to delete. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_delete_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,15 +115,78 @@ async def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + @overload + async def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: _models.RoleDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_or_update( @@ -112,36 +194,52 @@ async def create_or_update( vault_base_url: str, scope: str, role_definition_name: str, - parameters: "_models.RoleDefinitionCreateParameters", + parameters: Union[_models.RoleDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.RoleDefinition": + ) -> _models.RoleDefinition: """Creates or updates a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to create or update. Managed HSM only supports - '/'. + '/'. Required. :type scope: str :param role_definition_name: The name of the role definition to create or update. It can be any - valid GUID. + valid GUID. Required. :type role_definition_name: str - :param parameters: Parameters for the role definition. - :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters + :param parameters: Parameters for the role definition. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleDefinitionCreateParameters") request = build_create_or_update_request( scope=scope, @@ -149,19 +247,21 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -169,63 +269,64 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace_async async def get( - self, - vault_base_url: str, - scope: str, - role_definition_name: str, - **kwargs: Any - ) -> "_models.RoleDefinition": + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Get the specified role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition to get. Managed HSM only supports '/'. + :param scope: The scope of the role definition to get. Managed HSM only supports '/'. Required. :type scope: str - :param role_definition_name: The name of the role definition to get. + :param role_definition_name: The name of the role definition to get. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_get_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,79 +334,75 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace def list( - self, - vault_base_url: str, - scope: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleDefinitionListResult"]: + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.RoleDefinition"]: """Get all role definitions that are applicable at scope and above. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition. + :param scope: The scope of the role definition. Required. :type scope: str :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinitionListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.RoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleDefinition or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.RoleDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -319,10 +416,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -333,8 +428,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/__init__.py index 47bde45ad659..7d40b48af3ca 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/__init__.py @@ -6,82 +6,62 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import Error - from ._models_py3 import FullBackupOperation - from ._models_py3 import KeyVaultError - from ._models_py3 import Permission - from ._models_py3 import RestoreOperation - from ._models_py3 import RestoreOperationParameters - from ._models_py3 import RoleAssignment - from ._models_py3 import RoleAssignmentCreateParameters - from ._models_py3 import RoleAssignmentFilter - from ._models_py3 import RoleAssignmentListResult - from ._models_py3 import RoleAssignmentProperties - from ._models_py3 import RoleAssignmentPropertiesWithScope - from ._models_py3 import RoleDefinition - from ._models_py3 import RoleDefinitionCreateParameters - from ._models_py3 import RoleDefinitionFilter - from ._models_py3 import RoleDefinitionListResult - from ._models_py3 import RoleDefinitionProperties - from ._models_py3 import SASTokenParameter - from ._models_py3 import SelectiveKeyRestoreOperation - from ._models_py3 import SelectiveKeyRestoreOperationParameters -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import Error # type: ignore - from ._models import FullBackupOperation # type: ignore - from ._models import KeyVaultError # type: ignore - from ._models import Permission # type: ignore - from ._models import RestoreOperation # type: ignore - from ._models import RestoreOperationParameters # type: ignore - from ._models import RoleAssignment # type: ignore - from ._models import RoleAssignmentCreateParameters # type: ignore - from ._models import RoleAssignmentFilter # type: ignore - from ._models import RoleAssignmentListResult # type: ignore - from ._models import RoleAssignmentProperties # type: ignore - from ._models import RoleAssignmentPropertiesWithScope # type: ignore - from ._models import RoleDefinition # type: ignore - from ._models import RoleDefinitionCreateParameters # type: ignore - from ._models import RoleDefinitionFilter # type: ignore - from ._models import RoleDefinitionListResult # type: ignore - from ._models import RoleDefinitionProperties # type: ignore - from ._models import SASTokenParameter # type: ignore - from ._models import SelectiveKeyRestoreOperation # type: ignore - from ._models import SelectiveKeyRestoreOperationParameters # type: ignore +from ._models_py3 import Attributes +from ._models_py3 import Error +from ._models_py3 import FullBackupOperation +from ._models_py3 import KeyVaultError +from ._models_py3 import Permission +from ._models_py3 import RestoreOperation +from ._models_py3 import RestoreOperationParameters +from ._models_py3 import RoleAssignment +from ._models_py3 import RoleAssignmentCreateParameters +from ._models_py3 import RoleAssignmentFilter +from ._models_py3 import RoleAssignmentListResult +from ._models_py3 import RoleAssignmentProperties +from ._models_py3 import RoleAssignmentPropertiesWithScope +from ._models_py3 import RoleDefinition +from ._models_py3 import RoleDefinitionCreateParameters +from ._models_py3 import RoleDefinitionFilter +from ._models_py3 import RoleDefinitionListResult +from ._models_py3 import RoleDefinitionProperties +from ._models_py3 import SASTokenParameter +from ._models_py3 import SelectiveKeyRestoreOperation +from ._models_py3 import SelectiveKeyRestoreOperationParameters -from ._key_vault_client_enums import ( - DataAction, - RoleDefinitionType, - RoleScope, - RoleType, -) +from ._key_vault_client_enums import DataAction +from ._key_vault_client_enums import RoleDefinitionType +from ._key_vault_client_enums import RoleScope +from ._key_vault_client_enums import RoleType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'Error', - 'FullBackupOperation', - 'KeyVaultError', - 'Permission', - 'RestoreOperation', - 'RestoreOperationParameters', - 'RoleAssignment', - 'RoleAssignmentCreateParameters', - 'RoleAssignmentFilter', - 'RoleAssignmentListResult', - 'RoleAssignmentProperties', - 'RoleAssignmentPropertiesWithScope', - 'RoleDefinition', - 'RoleDefinitionCreateParameters', - 'RoleDefinitionFilter', - 'RoleDefinitionListResult', - 'RoleDefinitionProperties', - 'SASTokenParameter', - 'SelectiveKeyRestoreOperation', - 'SelectiveKeyRestoreOperationParameters', - 'DataAction', - 'RoleDefinitionType', - 'RoleScope', - 'RoleType', + "Attributes", + "Error", + "FullBackupOperation", + "KeyVaultError", + "Permission", + "RestoreOperation", + "RestoreOperationParameters", + "RoleAssignment", + "RoleAssignmentCreateParameters", + "RoleAssignmentFilter", + "RoleAssignmentListResult", + "RoleAssignmentProperties", + "RoleAssignmentPropertiesWithScope", + "RoleDefinition", + "RoleDefinitionCreateParameters", + "RoleDefinitionFilter", + "RoleDefinitionListResult", + "RoleDefinitionProperties", + "SASTokenParameter", + "SelectiveKeyRestoreOperation", + "SelectiveKeyRestoreOperationParameters", + "DataAction", + "RoleDefinitionType", + "RoleScope", + "RoleType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_key_vault_client_enums.py index d77201ab1934..dced7457f01c 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_key_vault_client_enums.py @@ -7,13 +7,11 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Supported permissions for data actions. - """ +class DataAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported permissions for data actions.""" #: Read HSM key metadata. READ_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/read/action" @@ -78,24 +76,24 @@ class DataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Read an HSM restore status. READ_HSM_RESTORE_STATUS = "Microsoft.KeyVault/managedHsm/restore/status/action" -class RoleDefinitionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role definition type. - """ + +class RoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role definition type.""" MICROSOFT_AUTHORIZATION_ROLE_DEFINITIONS = "Microsoft.Authorization/roleDefinitions" -class RoleScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role scope. - """ - #: Global scope. - GLOBAL_ENUM = "/" - #: Keys scope. +class RoleScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role scope.""" + + #: Global scope + GLOBAL = "/" + #: Keys scope KEYS = "/keys" -class RoleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role type. - """ + +class RoleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role type.""" #: Built in role. BUILT_IN_ROLE = "AKVBuiltInRole" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models.py deleted file mode 100644 index f4c951790b63..000000000000 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models.py +++ /dev/null @@ -1,845 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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 FullBackupOperation(msrest.serialization.Model): - """Full backup operation. - - :ivar status: Status of the backup operation. - :vartype status: str - :ivar status_details: The status details of backup operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the full backup operation. - :vartype error: ~azure.keyvault.v7_2.models.Error - :ivar start_time: The start time of the backup operation in UTC. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the backup operation in UTC. - :vartype end_time: ~datetime.datetime - :ivar job_id: Identifier for the full backup operation. - :vartype job_id: str - :ivar azure_storage_blob_container_uri: The Azure blob storage container Uri which contains the - full backup. - :vartype azure_storage_blob_container_uri: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'azure_storage_blob_container_uri': {'key': 'azureStorageBlobContainerUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the backup operation. - :paramtype status: str - :keyword status_details: The status details of backup operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the full backup operation. - :paramtype error: ~azure.keyvault.v7_2.models.Error - :keyword start_time: The start time of the backup operation in UTC. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the backup operation in UTC. - :paramtype end_time: ~datetime.datetime - :keyword job_id: Identifier for the full backup operation. - :paramtype job_id: str - :keyword azure_storage_blob_container_uri: The Azure blob storage container Uri which contains - the full backup. - :paramtype azure_storage_blob_container_uri: str - """ - super(FullBackupOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.job_id = kwargs.get('job_id', None) - self.azure_storage_blob_container_uri = kwargs.get('azure_storage_blob_container_uri', 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 Permission(msrest.serialization.Model): - """Role definition permissions. - - :ivar actions: Action permissions that are granted. - :vartype actions: list[str] - :ivar not_actions: Action permissions that are excluded but not denied. They may be granted by - other role definitions assigned to a principal. - :vartype not_actions: list[str] - :ivar data_actions: Data action permissions that are granted. - :vartype data_actions: list[str or ~azure.keyvault.v7_2.models.DataAction] - :ivar not_data_actions: Data action permissions that are excluded but not denied. They may be - granted by other role definitions assigned to a principal. - :vartype not_data_actions: list[str or ~azure.keyvault.v7_2.models.DataAction] - """ - - _attribute_map = { - 'actions': {'key': 'actions', 'type': '[str]'}, - 'not_actions': {'key': 'notActions', 'type': '[str]'}, - 'data_actions': {'key': 'dataActions', 'type': '[str]'}, - 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword actions: Action permissions that are granted. - :paramtype actions: list[str] - :keyword not_actions: Action permissions that are excluded but not denied. They may be granted - by other role definitions assigned to a principal. - :paramtype not_actions: list[str] - :keyword data_actions: Data action permissions that are granted. - :paramtype data_actions: list[str or ~azure.keyvault.v7_2.models.DataAction] - :keyword not_data_actions: Data action permissions that are excluded but not denied. They may - be granted by other role definitions assigned to a principal. - :paramtype not_data_actions: list[str or ~azure.keyvault.v7_2.models.DataAction] - """ - super(Permission, self).__init__(**kwargs) - self.actions = kwargs.get('actions', None) - self.not_actions = kwargs.get('not_actions', None) - self.data_actions = kwargs.get('data_actions', None) - self.not_data_actions = kwargs.get('not_data_actions', None) - - -class RestoreOperation(msrest.serialization.Model): - """Restore operation. - - :ivar status: Status of the restore operation. - :vartype status: str - :ivar status_details: The status details of restore operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the restore operation. - :vartype error: ~azure.keyvault.v7_2.models.Error - :ivar job_id: Identifier for the restore operation. - :vartype job_id: str - :ivar start_time: The start time of the restore operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the restore operation. - :vartype end_time: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the restore operation. - :paramtype status: str - :keyword status_details: The status details of restore operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the restore operation. - :paramtype error: ~azure.keyvault.v7_2.models.Error - :keyword job_id: Identifier for the restore operation. - :paramtype job_id: str - :keyword start_time: The start time of the restore operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the restore operation. - :paramtype end_time: ~datetime.datetime - """ - super(RestoreOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.job_id = kwargs.get('job_id', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class RestoreOperationParameters(msrest.serialization.Model): - """RestoreOperationParameters. - - All required parameters must be populated in order to send to Azure. - - :ivar sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. - :vartype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :ivar folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. - :vartype folder_to_restore: str - """ - - _validation = { - 'sas_token_parameters': {'required': True}, - 'folder_to_restore': {'required': True}, - } - - _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder_to_restore': {'key': 'folderToRestore', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. - :paramtype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :keyword folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. - :paramtype folder_to_restore: str - """ - super(RestoreOperationParameters, self).__init__(**kwargs) - self.sas_token_parameters = kwargs['sas_token_parameters'] - self.folder_to_restore = kwargs['folder_to_restore'] - - -class RoleAssignment(msrest.serialization.Model): - """Role Assignments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role assignment ID. - :vartype id: str - :ivar name: The role assignment name. - :vartype name: str - :ivar type: The role assignment type. - :vartype type: str - :ivar properties: Role assignment properties. - :vartype properties: ~azure.keyvault.v7_2.models.RoleAssignmentPropertiesWithScope - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Role assignment properties. - :paramtype properties: ~azure.keyvault.v7_2.models.RoleAssignmentPropertiesWithScope - """ - super(RoleAssignment, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class RoleAssignmentCreateParameters(msrest.serialization.Model): - """Role assignment create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Required. Role assignment properties. - :vartype properties: ~azure.keyvault.v7_2.models.RoleAssignmentProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Required. Role assignment properties. - :paramtype properties: ~azure.keyvault.v7_2.models.RoleAssignmentProperties - """ - super(RoleAssignmentCreateParameters, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RoleAssignmentFilter(msrest.serialization.Model): - """Role Assignments filter. - - :ivar principal_id: Returns role assignment of the specific principal. - :vartype principal_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword principal_id: Returns role assignment of the specific principal. - :paramtype principal_id: str - """ - super(RoleAssignmentFilter, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - - -class RoleAssignmentListResult(msrest.serialization.Model): - """Role assignment list operation result. - - :ivar value: Role assignment list. - :vartype value: list[~azure.keyvault.v7_2.models.RoleAssignment] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleAssignment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Role assignment list. - :paramtype value: list[~azure.keyvault.v7_2.models.RoleAssignment] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super(RoleAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RoleAssignmentProperties(msrest.serialization.Model): - """Role assignment properties. - - All required parameters must be populated in order to send to Azure. - - :ivar role_definition_id: Required. The role definition ID used in the role assignment. - :vartype role_definition_id: str - :ivar principal_id: Required. The principal ID assigned to the role. This maps to the ID inside - the Active Directory. It can point to a user, service principal, or security group. - :vartype principal_id: str - """ - - _validation = { - 'role_definition_id': {'required': True}, - 'principal_id': {'required': True}, - } - - _attribute_map = { - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_definition_id: Required. The role definition ID used in the role assignment. - :paramtype role_definition_id: str - :keyword principal_id: Required. The principal ID assigned to the role. This maps to the ID - inside the Active Directory. It can point to a user, service principal, or security group. - :paramtype principal_id: str - """ - super(RoleAssignmentProperties, self).__init__(**kwargs) - self.role_definition_id = kwargs['role_definition_id'] - self.principal_id = kwargs['principal_id'] - - -class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): - """Role assignment properties with scope. - - :ivar scope: The role scope. Possible values include: "/", "/keys". - :vartype scope: str or ~azure.keyvault.v7_2.models.RoleScope - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - """ - - _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword scope: The role scope. Possible values include: "/", "/keys". - :paramtype scope: str or ~azure.keyvault.v7_2.models.RoleScope - :keyword role_definition_id: The role definition ID. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. - :paramtype principal_id: str - """ - super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) - self.scope = kwargs.get('scope', None) - self.role_definition_id = kwargs.get('role_definition_id', None) - self.principal_id = kwargs.get('principal_id', None) - - -class RoleDefinition(msrest.serialization.Model): - """Role definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role definition ID. - :vartype id: str - :ivar name: The role definition name. - :vartype name: str - :ivar type: The role definition type. Possible values include: - "Microsoft.Authorization/roleDefinitions". - :vartype type: str or ~azure.keyvault.v7_2.models.RoleDefinitionType - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :vartype role_type: str or ~azure.keyvault.v7_2.models.RoleType - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.keyvault.v7_2.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'role_type': {'key': 'properties.type', 'type': 'str'}, - 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :paramtype role_type: str or ~azure.keyvault.v7_2.models.RoleType - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.keyvault.v7_2.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] - """ - super(RoleDefinition, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.role_name = kwargs.get('role_name', None) - self.description = kwargs.get('description', None) - self.role_type = kwargs.get('role_type', None) - self.permissions = kwargs.get('permissions', None) - self.assignable_scopes = kwargs.get('assignable_scopes', None) - - -class RoleDefinitionCreateParameters(msrest.serialization.Model): - """Role definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Required. Role definition properties. - :vartype properties: ~azure.keyvault.v7_2.models.RoleDefinitionProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Required. Role definition properties. - :paramtype properties: ~azure.keyvault.v7_2.models.RoleDefinitionProperties - """ - super(RoleDefinitionCreateParameters, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RoleDefinitionFilter(msrest.serialization.Model): - """Role Definitions filter. - - :ivar role_name: Returns role definition with the specific name. - :vartype role_name: str - """ - - _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: Returns role definition with the specific name. - :paramtype role_name: str - """ - super(RoleDefinitionFilter, self).__init__(**kwargs) - self.role_name = kwargs.get('role_name', None) - - -class RoleDefinitionListResult(msrest.serialization.Model): - """Role definition list operation result. - - :ivar value: Role definition list. - :vartype value: list[~azure.keyvault.v7_2.models.RoleDefinition] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Role definition list. - :paramtype value: list[~azure.keyvault.v7_2.models.RoleDefinition] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super(RoleDefinitionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RoleDefinitionProperties(msrest.serialization.Model): - """Role definition properties. - - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :vartype role_type: str or ~azure.keyvault.v7_2.models.RoleType - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.keyvault.v7_2.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] - """ - - _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'role_type': {'key': 'type', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :paramtype role_type: str or ~azure.keyvault.v7_2.models.RoleType - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.keyvault.v7_2.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] - """ - super(RoleDefinitionProperties, self).__init__(**kwargs) - self.role_name = kwargs.get('role_name', None) - self.description = kwargs.get('description', None) - self.role_type = kwargs.get('role_type', None) - self.permissions = kwargs.get('permissions', None) - self.assignable_scopes = kwargs.get('assignable_scopes', None) - - -class SASTokenParameter(msrest.serialization.Model): - """SASTokenParameter. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_resource_uri: Required. Azure Blob storage container Uri. - :vartype storage_resource_uri: str - :ivar token: Required. The SAS token pointing to an Azure Blob storage container. - :vartype token: str - """ - - _validation = { - 'storage_resource_uri': {'required': True}, - 'token': {'required': True}, - } - - _attribute_map = { - 'storage_resource_uri': {'key': 'storageResourceUri', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword storage_resource_uri: Required. Azure Blob storage container Uri. - :paramtype storage_resource_uri: str - :keyword token: Required. The SAS token pointing to an Azure Blob storage container. - :paramtype token: str - """ - super(SASTokenParameter, self).__init__(**kwargs) - self.storage_resource_uri = kwargs['storage_resource_uri'] - self.token = kwargs['token'] - - -class SelectiveKeyRestoreOperation(msrest.serialization.Model): - """Selective Key Restore operation. - - :ivar status: Status of the restore operation. - :vartype status: str - :ivar status_details: The status details of restore operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the selective key restore operation. - :vartype error: ~azure.keyvault.v7_2.models.Error - :ivar job_id: Identifier for the selective key restore operation. - :vartype job_id: str - :ivar start_time: The start time of the restore operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the restore operation. - :vartype end_time: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the restore operation. - :paramtype status: str - :keyword status_details: The status details of restore operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the selective key restore operation. - :paramtype error: ~azure.keyvault.v7_2.models.Error - :keyword job_id: Identifier for the selective key restore operation. - :paramtype job_id: str - :keyword start_time: The start time of the restore operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the restore operation. - :paramtype end_time: ~datetime.datetime - """ - super(SelectiveKeyRestoreOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.job_id = kwargs.get('job_id', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class SelectiveKeyRestoreOperationParameters(msrest.serialization.Model): - """SelectiveKeyRestoreOperationParameters. - - All required parameters must be populated in order to send to Azure. - - :ivar sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. - :vartype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :ivar folder: Required. The Folder name of the blob where the previous successful full backup - was stored. - :vartype folder: str - """ - - _validation = { - 'sas_token_parameters': {'required': True}, - 'folder': {'required': True}, - } - - _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder': {'key': 'folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. - :paramtype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :keyword folder: Required. The Folder name of the blob where the previous successful full - backup was stored. - :paramtype folder: str - """ - super(SelectiveKeyRestoreOperationParameters, self).__init__(**kwargs) - self.sas_token_parameters = kwargs['sas_token_parameters'] - self.folder = kwargs['folder'] diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models_py3.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models_py3.py index 0fed491bcb30..c88a96cea66b 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, Union +from typing import List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): +class Attributes(_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. @@ -33,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -61,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -69,7 +71,7 @@ def __init__( self.updated = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -83,30 +85,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class FullBackupOperation(msrest.serialization.Model): +class FullBackupOperation(_serialization.Model): """Full backup operation. :ivar status: Status of the backup operation. @@ -127,13 +125,13 @@ class FullBackupOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'azure_storage_blob_container_uri': {'key': 'azureStorageBlobContainerUri', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, + "job_id": {"key": "jobId", "type": "str"}, + "azure_storage_blob_container_uri": {"key": "azureStorageBlobContainerUri", "type": "str"}, } def __init__( @@ -141,7 +139,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, job_id: Optional[str] = None, @@ -165,7 +163,7 @@ def __init__( the full backup. :paramtype azure_storage_blob_container_uri: str """ - super(FullBackupOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -175,7 +173,7 @@ def __init__( self.azure_storage_blob_container_uri = azure_storage_blob_container_uri -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -185,24 +183,20 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class Permission(msrest.serialization.Model): +class Permission(_serialization.Model): """Role definition permissions. :ivar actions: Action permissions that are granted. @@ -218,10 +212,10 @@ class Permission(msrest.serialization.Model): """ _attribute_map = { - 'actions': {'key': 'actions', 'type': '[str]'}, - 'not_actions': {'key': 'notActions', 'type': '[str]'}, - 'data_actions': {'key': 'dataActions', 'type': '[str]'}, - 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, + "actions": {"key": "actions", "type": "[str]"}, + "not_actions": {"key": "notActions", "type": "[str]"}, + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, } def __init__( @@ -229,8 +223,8 @@ def __init__( *, actions: Optional[List[str]] = None, not_actions: Optional[List[str]] = None, - data_actions: Optional[List[Union[str, "DataAction"]]] = None, - not_data_actions: Optional[List[Union[str, "DataAction"]]] = None, + data_actions: Optional[List[Union[str, "_models.DataAction"]]] = None, + not_data_actions: Optional[List[Union[str, "_models.DataAction"]]] = None, **kwargs ): """ @@ -245,14 +239,14 @@ def __init__( be granted by other role definitions assigned to a principal. :paramtype not_data_actions: list[str or ~azure.keyvault.v7_2.models.DataAction] """ - super(Permission, self).__init__(**kwargs) + super().__init__(**kwargs) self.actions = actions self.not_actions = not_actions self.data_actions = data_actions self.not_data_actions = not_data_actions -class RestoreOperation(msrest.serialization.Model): +class RestoreOperation(_serialization.Model): """Restore operation. :ivar status: Status of the restore operation. @@ -270,12 +264,12 @@ class RestoreOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, } def __init__( @@ -283,7 +277,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, @@ -303,7 +297,7 @@ def __init__( :keyword end_time: The end time of the restore operation. :paramtype end_time: ~datetime.datetime """ - super(RestoreOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -312,50 +306,44 @@ def __init__( self.end_time = end_time -class RestoreOperationParameters(msrest.serialization.Model): +class RestoreOperationParameters(_serialization.Model): """RestoreOperationParameters. All required parameters must be populated in order to send to Azure. - :ivar sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. + :ivar sas_token_parameters: SAS token parameter object containing Azure storage resourceUri and + token. Required. :vartype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :ivar folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. + :ivar folder_to_restore: The Folder name of the blob where the previous successful full backup + was stored. Required. :vartype folder_to_restore: str """ _validation = { - 'sas_token_parameters': {'required': True}, - 'folder_to_restore': {'required': True}, + "sas_token_parameters": {"required": True}, + "folder_to_restore": {"required": True}, } _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder_to_restore': {'key': 'folderToRestore', 'type': 'str'}, + "sas_token_parameters": {"key": "sasTokenParameters", "type": "SASTokenParameter"}, + "folder_to_restore": {"key": "folderToRestore", "type": "str"}, } - def __init__( - self, - *, - sas_token_parameters: "SASTokenParameter", - folder_to_restore: str, - **kwargs - ): + def __init__(self, *, sas_token_parameters: "_models.SASTokenParameter", folder_to_restore: str, **kwargs): """ - :keyword sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. + :keyword sas_token_parameters: SAS token parameter object containing Azure storage resourceUri + and token. Required. :paramtype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :keyword folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. + :keyword folder_to_restore: The Folder name of the blob where the previous successful full + backup was stored. Required. :paramtype folder_to_restore: str """ - super(RestoreOperationParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.sas_token_parameters = sas_token_parameters self.folder_to_restore = folder_to_restore -class RoleAssignment(msrest.serialization.Model): +class RoleAssignment(_serialization.Model): """Role Assignments. Variables are only populated by the server, and will be ignored when sending a request. @@ -371,67 +359,57 @@ class RoleAssignment(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "RoleAssignmentPropertiesWithScope"}, } - def __init__( - self, - *, - properties: Optional["RoleAssignmentPropertiesWithScope"] = None, - **kwargs - ): + def __init__(self, *, properties: Optional["_models.RoleAssignmentPropertiesWithScope"] = None, **kwargs): """ :keyword properties: Role assignment properties. :paramtype properties: ~azure.keyvault.v7_2.models.RoleAssignmentPropertiesWithScope """ - super(RoleAssignment, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.properties = properties -class RoleAssignmentCreateParameters(msrest.serialization.Model): +class RoleAssignmentCreateParameters(_serialization.Model): """Role assignment create parameters. All required parameters must be populated in order to send to Azure. - :ivar properties: Required. Role assignment properties. + :ivar properties: Role assignment properties. Required. :vartype properties: ~azure.keyvault.v7_2.models.RoleAssignmentProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, + "properties": {"key": "properties", "type": "RoleAssignmentProperties"}, } - def __init__( - self, - *, - properties: "RoleAssignmentProperties", - **kwargs - ): + def __init__(self, *, properties: "_models.RoleAssignmentProperties", **kwargs): """ - :keyword properties: Required. Role assignment properties. + :keyword properties: Role assignment properties. Required. :paramtype properties: ~azure.keyvault.v7_2.models.RoleAssignmentProperties """ - super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties -class RoleAssignmentFilter(msrest.serialization.Model): +class RoleAssignmentFilter(_serialization.Model): """Role Assignments filter. :ivar principal_id: Returns role assignment of the specific principal. @@ -439,24 +417,19 @@ class RoleAssignmentFilter(msrest.serialization.Model): """ _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, } - def __init__( - self, - *, - principal_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs): """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str """ - super(RoleAssignmentFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = principal_id -class RoleAssignmentListResult(msrest.serialization.Model): +class RoleAssignmentListResult(_serialization.Model): """Role assignment list operation result. :ivar value: Role assignment list. @@ -466,16 +439,12 @@ class RoleAssignmentListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleAssignment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RoleAssignment]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RoleAssignment"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs ): """ :keyword value: Role assignment list. @@ -483,56 +452,50 @@ def __init__( :keyword next_link: The URL to use for getting the next set of results. :paramtype next_link: str """ - super(RoleAssignmentListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RoleAssignmentProperties(msrest.serialization.Model): +class RoleAssignmentProperties(_serialization.Model): """Role assignment properties. All required parameters must be populated in order to send to Azure. - :ivar role_definition_id: Required. The role definition ID used in the role assignment. + :ivar role_definition_id: The role definition ID used in the role assignment. Required. :vartype role_definition_id: str - :ivar principal_id: Required. The principal ID assigned to the role. This maps to the ID inside - the Active Directory. It can point to a user, service principal, or security group. + :ivar principal_id: The principal ID assigned to the role. This maps to the ID inside the + Active Directory. It can point to a user, service principal, or security group. Required. :vartype principal_id: str """ _validation = { - 'role_definition_id': {'required': True}, - 'principal_id': {'required': True}, + "role_definition_id": {"required": True}, + "principal_id": {"required": True}, } _attribute_map = { - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, } - def __init__( - self, - *, - role_definition_id: str, - principal_id: str, - **kwargs - ): + def __init__(self, *, role_definition_id: str, principal_id: str, **kwargs): """ - :keyword role_definition_id: Required. The role definition ID used in the role assignment. + :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str - :keyword principal_id: Required. The principal ID assigned to the role. This maps to the ID - inside the Active Directory. It can point to a user, service principal, or security group. + :keyword principal_id: The principal ID assigned to the role. This maps to the ID inside the + Active Directory. It can point to a user, service principal, or security group. Required. :paramtype principal_id: str """ - super(RoleAssignmentProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_definition_id = role_definition_id self.principal_id = principal_id -class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): +class RoleAssignmentPropertiesWithScope(_serialization.Model): """Role assignment properties with scope. - :ivar scope: The role scope. Possible values include: "/", "/keys". + :ivar scope: The role scope. Known values are: "/" and "/keys". :vartype scope: str or ~azure.keyvault.v7_2.models.RoleScope :ivar role_definition_id: The role definition ID. :vartype role_definition_id: str @@ -541,34 +504,34 @@ class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): """ _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "scope": {"key": "scope", "type": "str"}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, } def __init__( self, *, - scope: Optional[Union[str, "RoleScope"]] = None, + scope: Optional[Union[str, "_models.RoleScope"]] = None, role_definition_id: Optional[str] = None, principal_id: Optional[str] = None, **kwargs ): """ - :keyword scope: The role scope. Possible values include: "/", "/keys". + :keyword scope: The role scope. Known values are: "/" and "/keys". :paramtype scope: str or ~azure.keyvault.v7_2.models.RoleScope :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str :keyword principal_id: The principal ID. :paramtype principal_id: str """ - super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) + super().__init__(**kwargs) self.scope = scope self.role_definition_id = role_definition_id self.principal_id = principal_id -class RoleDefinition(msrest.serialization.Model): +class RoleDefinition(_serialization.Model): """Role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -577,14 +540,13 @@ class RoleDefinition(msrest.serialization.Model): :vartype id: str :ivar name: The role definition name. :vartype name: str - :ivar type: The role definition type. Possible values include: - "Microsoft.Authorization/roleDefinitions". + :ivar type: The role definition type. "Microsoft.Authorization/roleDefinitions" :vartype type: str or ~azure.keyvault.v7_2.models.RoleDefinitionType :ivar role_name: The role name. :vartype role_name: str :ivar description: The role definition description. :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :ivar role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :vartype role_type: str or ~azure.keyvault.v7_2.models.RoleType :ivar permissions: Role definition permissions. :vartype permissions: list[~azure.keyvault.v7_2.models.Permission] @@ -593,20 +555,20 @@ class RoleDefinition(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'role_type': {'key': 'properties.type', 'type': 'str'}, - 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "role_name": {"key": "properties.roleName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "role_type": {"key": "properties.type", "type": "str"}, + "permissions": {"key": "properties.permissions", "type": "[Permission]"}, + "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, } def __init__( @@ -614,9 +576,9 @@ def __init__( *, role_name: Optional[str] = None, description: Optional[str] = None, - role_type: Optional[Union[str, "RoleType"]] = None, - permissions: Optional[List["Permission"]] = None, - assignable_scopes: Optional[List[Union[str, "RoleScope"]]] = None, + role_type: Optional[Union[str, "_models.RoleType"]] = None, + permissions: Optional[List["_models.Permission"]] = None, + assignable_scopes: Optional[List[Union[str, "_models.RoleScope"]]] = None, **kwargs ): """ @@ -624,14 +586,14 @@ def __init__( :paramtype role_name: str :keyword description: The role definition description. :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :keyword role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :paramtype role_type: str or ~azure.keyvault.v7_2.models.RoleType :keyword permissions: Role definition permissions. :paramtype permissions: list[~azure.keyvault.v7_2.models.Permission] :keyword assignable_scopes: Role definition assignable scopes. :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] """ - super(RoleDefinition, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -642,38 +604,33 @@ def __init__( self.assignable_scopes = assignable_scopes -class RoleDefinitionCreateParameters(msrest.serialization.Model): +class RoleDefinitionCreateParameters(_serialization.Model): """Role definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar properties: Required. Role definition properties. + :ivar properties: Role definition properties. Required. :vartype properties: ~azure.keyvault.v7_2.models.RoleDefinitionProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, + "properties": {"key": "properties", "type": "RoleDefinitionProperties"}, } - def __init__( - self, - *, - properties: "RoleDefinitionProperties", - **kwargs - ): + def __init__(self, *, properties: "_models.RoleDefinitionProperties", **kwargs): """ - :keyword properties: Required. Role definition properties. + :keyword properties: Role definition properties. Required. :paramtype properties: ~azure.keyvault.v7_2.models.RoleDefinitionProperties """ - super(RoleDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties -class RoleDefinitionFilter(msrest.serialization.Model): +class RoleDefinitionFilter(_serialization.Model): """Role Definitions filter. :ivar role_name: Returns role definition with the specific name. @@ -681,24 +638,19 @@ class RoleDefinitionFilter(msrest.serialization.Model): """ _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, + "role_name": {"key": "roleName", "type": "str"}, } - def __init__( - self, - *, - role_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, role_name: Optional[str] = None, **kwargs): """ :keyword role_name: Returns role definition with the specific name. :paramtype role_name: str """ - super(RoleDefinitionFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_name = role_name -class RoleDefinitionListResult(msrest.serialization.Model): +class RoleDefinitionListResult(_serialization.Model): """Role definition list operation result. :ivar value: Role definition list. @@ -708,16 +660,12 @@ class RoleDefinitionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RoleDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RoleDefinition"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs ): """ :keyword value: Role definition list. @@ -725,19 +673,19 @@ def __init__( :keyword next_link: The URL to use for getting the next set of results. :paramtype next_link: str """ - super(RoleDefinitionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RoleDefinitionProperties(msrest.serialization.Model): +class RoleDefinitionProperties(_serialization.Model): """Role definition properties. :ivar role_name: The role name. :vartype role_name: str :ivar description: The role definition description. :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :ivar role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :vartype role_type: str or ~azure.keyvault.v7_2.models.RoleType :ivar permissions: Role definition permissions. :vartype permissions: list[~azure.keyvault.v7_2.models.Permission] @@ -746,11 +694,11 @@ class RoleDefinitionProperties(msrest.serialization.Model): """ _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'role_type': {'key': 'type', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, + "role_name": {"key": "roleName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "role_type": {"key": "type", "type": "str"}, + "permissions": {"key": "permissions", "type": "[Permission]"}, + "assignable_scopes": {"key": "assignableScopes", "type": "[str]"}, } def __init__( @@ -758,9 +706,9 @@ def __init__( *, role_name: Optional[str] = None, description: Optional[str] = None, - role_type: Optional[Union[str, "RoleType"]] = None, - permissions: Optional[List["Permission"]] = None, - assignable_scopes: Optional[List[Union[str, "RoleScope"]]] = None, + role_type: Optional[Union[str, "_models.RoleType"]] = None, + permissions: Optional[List["_models.Permission"]] = None, + assignable_scopes: Optional[List[Union[str, "_models.RoleScope"]]] = None, **kwargs ): """ @@ -768,14 +716,14 @@ def __init__( :paramtype role_name: str :keyword description: The role definition description. :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :keyword role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :paramtype role_type: str or ~azure.keyvault.v7_2.models.RoleType :keyword permissions: Role definition permissions. :paramtype permissions: list[~azure.keyvault.v7_2.models.Permission] :keyword assignable_scopes: Role definition assignable scopes. :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_2.models.RoleScope] """ - super(RoleDefinitionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_name = role_name self.description = description self.role_type = role_type @@ -783,46 +731,40 @@ def __init__( self.assignable_scopes = assignable_scopes -class SASTokenParameter(msrest.serialization.Model): +class SASTokenParameter(_serialization.Model): """SASTokenParameter. All required parameters must be populated in order to send to Azure. - :ivar storage_resource_uri: Required. Azure Blob storage container Uri. + :ivar storage_resource_uri: Azure Blob storage container Uri. Required. :vartype storage_resource_uri: str - :ivar token: Required. The SAS token pointing to an Azure Blob storage container. + :ivar token: The SAS token pointing to an Azure Blob storage container. Required. :vartype token: str """ _validation = { - 'storage_resource_uri': {'required': True}, - 'token': {'required': True}, + "storage_resource_uri": {"required": True}, + "token": {"required": True}, } _attribute_map = { - 'storage_resource_uri': {'key': 'storageResourceUri', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, + "storage_resource_uri": {"key": "storageResourceUri", "type": "str"}, + "token": {"key": "token", "type": "str"}, } - def __init__( - self, - *, - storage_resource_uri: str, - token: str, - **kwargs - ): + def __init__(self, *, storage_resource_uri: str, token: str, **kwargs): """ - :keyword storage_resource_uri: Required. Azure Blob storage container Uri. + :keyword storage_resource_uri: Azure Blob storage container Uri. Required. :paramtype storage_resource_uri: str - :keyword token: Required. The SAS token pointing to an Azure Blob storage container. + :keyword token: The SAS token pointing to an Azure Blob storage container. Required. :paramtype token: str """ - super(SASTokenParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_resource_uri = storage_resource_uri self.token = token -class SelectiveKeyRestoreOperation(msrest.serialization.Model): +class SelectiveKeyRestoreOperation(_serialization.Model): """Selective Key Restore operation. :ivar status: Status of the restore operation. @@ -840,12 +782,12 @@ class SelectiveKeyRestoreOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, } def __init__( @@ -853,7 +795,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, @@ -873,7 +815,7 @@ def __init__( :keyword end_time: The end time of the restore operation. :paramtype end_time: ~datetime.datetime """ - super(SelectiveKeyRestoreOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -882,44 +824,38 @@ def __init__( self.end_time = end_time -class SelectiveKeyRestoreOperationParameters(msrest.serialization.Model): +class SelectiveKeyRestoreOperationParameters(_serialization.Model): """SelectiveKeyRestoreOperationParameters. All required parameters must be populated in order to send to Azure. - :ivar sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. + :ivar sas_token_parameters: SAS token parameter object containing Azure storage resourceUri and + token. Required. :vartype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :ivar folder: Required. The Folder name of the blob where the previous successful full backup - was stored. + :ivar folder: The Folder name of the blob where the previous successful full backup was stored. + Required. :vartype folder: str """ _validation = { - 'sas_token_parameters': {'required': True}, - 'folder': {'required': True}, + "sas_token_parameters": {"required": True}, + "folder": {"required": True}, } _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder': {'key': 'folder', 'type': 'str'}, + "sas_token_parameters": {"key": "sasTokenParameters", "type": "SASTokenParameter"}, + "folder": {"key": "folder", "type": "str"}, } - def __init__( - self, - *, - sas_token_parameters: "SASTokenParameter", - folder: str, - **kwargs - ): + def __init__(self, *, sas_token_parameters: "_models.SASTokenParameter", folder: str, **kwargs): """ - :keyword sas_token_parameters: Required. SAS token parameter object containing Azure storage - resourceUri and token. + :keyword sas_token_parameters: SAS token parameter object containing Azure storage resourceUri + and token. Required. :paramtype sas_token_parameters: ~azure.keyvault.v7_2.models.SASTokenParameter - :keyword folder: Required. The Folder name of the blob where the previous successful full - backup was stored. + :keyword folder: The Folder name of the blob where the previous successful full backup was + stored. Required. :paramtype folder: str """ - super(SelectiveKeyRestoreOperationParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.sas_token_parameters = sas_token_parameters self.folder = folder diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/__init__.py index f871fcce6e3a..c53e46e634a2 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/__init__.py @@ -10,8 +10,14 @@ from ._role_assignments_operations import RoleAssignmentsOperations from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'RoleDefinitionsOperations', - 'RoleAssignmentsOperations', - 'KeyVaultClientOperationsMixin', + "RoleDefinitionsOperations", + "RoleAssignmentsOperations", + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_key_vault_client_operations.py index 220c160033c6..54779f2709a5 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_key_vault_client_operations.py @@ -6,270 +6,249 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.polling.base_polling import LROBasePolling from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_full_backup_request_initial( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_full_backup_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/backup") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_full_backup_status_request( - job_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_full_backup_status_request(job_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/backup/{jobId}/pending") path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_full_restore_operation_request_initial( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_full_restore_operation_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_status_request( - job_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_status_request(job_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/restore/{jobId}/pending") path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_selective_key_restore_operation_request_initial( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_selective_key_restore_operation_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{keyName}/restore") path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): +class KeyVaultClientOperationsMixin(MixinABC): def _full_backup_initial( self, - vault_base_url, # type: str - azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"] - **kwargs # type: Any - ): - # type: (...) -> "_models.FullBackupOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> _models.FullBackupOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - if azure_storage_blob_container_uri is not None: - _json = self._serialize.body(azure_storage_blob_container_uri, 'SASTokenParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(azure_storage_blob_container_uri, (IO, bytes)): + _content = azure_storage_blob_container_uri else: - _json = None + if azure_storage_blob_container_uri is not None: + _json = self._serialize.body(azure_storage_blob_container_uri, "SASTokenParameter") + else: + _json = None - request = build_full_backup_request_initial( + request = build_full_backup_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_backup_initial.metadata['url'], + content=_content, + template_url=self._full_backup_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_backup_initial.metadata = {'url': "/backup"} # type: ignore + _full_backup_initial.metadata = {"url": "/backup"} # type: ignore - - @distributed_trace + @overload def begin_full_backup( self, - vault_base_url, # type: str - azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FullBackupOperation"] + vault_base_url: str, + azure_storage_blob_container_uri: Optional[_models.SASTokenParameter] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call. Default value is None. :type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -281,102 +260,185 @@ def begin_full_backup( :return: An instance of LROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Default value is None. + :type azure_storage_blob_container_uri: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._full_backup_initial( + raw_result = self._full_backup_initial( # type: ignore vault_base_url=vault_base_url, azure_storage_blob_container_uri=azure_storage_blob_container_uri, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_backup.metadata = {'url': "/backup"} # type: ignore + begin_full_backup.metadata = {"url": "/backup"} # type: ignore @distributed_trace - def full_backup_status( - self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FullBackupOperation" + def full_backup_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - request = build_full_backup_status_request( job_id=job_id, api_version=api_version, - template_url=self.full_backup_status.metadata['url'], + template_url=self.full_backup_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,90 +446,108 @@ def full_backup_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - full_backup_status.metadata = {'url': "/backup/{jobId}/pending"} # type: ignore - + full_backup_status.metadata = {"url": "/backup/{jobId}/pending"} # type: ignore def _full_restore_operation_initial( self, - vault_base_url, # type: str - restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> _models.RestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'RestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "RestoreOperationParameters") + else: + _json = None - request = build_full_restore_operation_request_initial( + request = build_full_restore_operation_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._full_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_restore_operation_initial.metadata = {'url': "/restore"} # type: ignore - + _full_restore_operation_initial.metadata = {"url": "/restore"} # type: ignore - @distributed_trace + @overload def begin_full_restore_operation( self, - vault_base_url, # type: str - restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestoreOperation"] + vault_base_url: str, + restore_blob_details: Optional[_models.RestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -479,102 +559,182 @@ def begin_full_restore_operation( :return: An instance of LROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._full_restore_operation_initial( + raw_result = self._full_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('RestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_restore_operation.metadata = {'url': "/restore"} # type: ignore + begin_full_restore_operation.metadata = {"url": "/restore"} # type: ignore @distributed_trace - def restore_status( - self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreOperation" + def restore_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] - request = build_restore_status_request( job_id=job_id, api_version=api_version, - template_url=self.restore_status.metadata['url'], + template_url=self.restore_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,95 +742,186 @@ def restore_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_status.metadata = {'url': "/restore/{jobId}/pending"} # type: ignore - + restore_status.metadata = {"url": "/restore/{jobId}/pending"} # type: ignore def _selective_key_restore_operation_initial( self, - vault_base_url, # type: str - key_name, # type: str - restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SelectiveKeyRestoreOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> _models.SelectiveKeyRestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'SelectiveKeyRestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "SelectiveKeyRestoreOperationParameters") + else: + _json = None - request = build_selective_key_restore_operation_request_initial( + request = build_selective_key_restore_operation_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._selective_key_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._selective_key_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _selective_key_restore_operation_initial.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + _selective_key_restore_operation_initial.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore + + @overload + def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[_models.SelectiveKeyRestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace + @overload def begin_selective_key_restore_operation( self, - vault_base_url, # type: str - key_name, # type: str - restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SelectiveKeyRestoreOperation"] + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -682,55 +933,69 @@ def begin_selective_key_restore_operation( :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._selective_key_restore_operation_initial( + raw_result = self._selective_key_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, key_name=key_name, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_selective_key_restore_operation.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + begin_selective_key_restore_operation.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_assignments_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_assignments_operations.py index e0f1805cc4db..ee5764734fa1 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_assignments_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_assignments_operations.py @@ -6,175 +6,140 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_delete_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - accept = "application/json" +def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_scope_request( - scope, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - filter = kwargs.pop('filter', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -# fmt: on -class RoleAssignmentsOperations(object): + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoleAssignmentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -187,61 +152,61 @@ class RoleAssignmentsOperations(object): models = _models def __init__(self, *args, **kwargs): - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( - self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Deletes a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to delete. + :param scope: The scope of the role assignment to delete. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to delete. + :param role_assignment_name: The name of the role assignment to delete. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_delete_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,52 +214,128 @@ def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + @overload + def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: _models.RoleAssignmentCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create( self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - parameters, # type: "_models.RoleAssignmentCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: Union[_models.RoleAssignmentCreateParameters, IO], + **kwargs: Any + ) -> _models.RoleAssignment: """Creates a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to create. + :param scope: The scope of the role assignment to create. Required. :type scope: str :param role_assignment_name: The name of the role assignment to create. It can be any valid - GUID. + GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. - :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters + :param parameters: Parameters for the role assignment. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleAssignmentCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") request = build_create_request( scope=scope, @@ -302,19 +343,21 @@ def create( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create.metadata['url'], + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -322,64 +365,62 @@ def create( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace - def get( - self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + def get(self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: """Get the specified role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment. + :param scope: The scope of the role assignment. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to get. + :param role_assignment_name: The name of the role assignment to get. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_get_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -387,80 +428,76 @@ def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace def list_for_scope( - self, - vault_base_url, # type: str - scope, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleAssignmentListResult"] + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.RoleAssignment"]: """Gets role assignments for a scope. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignments. + :param scope: The scope of the role assignments. Required. :type scope: str :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.RoleAssignmentListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleAssignment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.RoleAssignment] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignmentListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_for_scope_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list_for_scope.metadata['url'], + api_version=api_version, + template_url=self.list_for_scope.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -474,10 +511,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -488,8 +523,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_for_scope.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_definitions_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_definitions_operations.py index 720c18d7b69c..74acd05c70cf 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_definitions_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2/operations/_role_definitions_operations.py @@ -6,175 +6,140 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_delete_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - accept = "application/json" +def build_delete_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - scope, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - filter = kwargs.pop('filter', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -# fmt: on -class RoleDefinitionsOperations(object): + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoleDefinitionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -187,61 +152,62 @@ class RoleDefinitionsOperations(object): models = _models def __init__(self, *args, **kwargs): - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( - self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Deletes a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to delete. Managed HSM only supports '/'. + Required. :type scope: str - :param role_definition_name: The name (GUID) of the role definition to delete. + :param role_definition_name: The name (GUID) of the role definition to delete. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_delete_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,53 +215,131 @@ def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + @overload + def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: _models.RoleDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_or_update( self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - parameters, # type: "_models.RoleDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: Union[_models.RoleDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _models.RoleDefinition: """Creates or updates a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to create or update. Managed HSM only supports - '/'. + '/'. Required. :type scope: str :param role_definition_name: The name of the role definition to create or update. It can be any - valid GUID. + valid GUID. Required. :type role_definition_name: str - :param parameters: Parameters for the role definition. - :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters + :param parameters: Parameters for the role definition. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.RoleDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleDefinitionCreateParameters") request = build_create_or_update_request( scope=scope, @@ -303,19 +347,21 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -323,64 +369,62 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace - def get( - self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + def get(self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any) -> _models.RoleDefinition: """Get the specified role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition to get. Managed HSM only supports '/'. + :param scope: The scope of the role definition to get. Managed HSM only supports '/'. Required. :type scope: str - :param role_definition_name: The name of the role definition to get. + :param role_definition_name: The name of the role definition to get. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_get_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -388,79 +432,75 @@ def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace def list( - self, - vault_base_url, # type: str - scope, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleDefinitionListResult"] + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.RoleDefinition"]: """Get all role definitions that are applicable at scope and above. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition. + :param scope: The scope of the role definition. Required. :type scope: str :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinitionListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.RoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleDefinition or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.RoleDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -474,10 +514,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -488,8 +526,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_configuration.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_configuration.py index 628918574705..688734641467 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_configuration.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_configuration.py @@ -6,17 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any 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): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. @@ -28,30 +25,24 @@ class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-in :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str - + api_version = kwargs.pop("api_version", "7.3") # type: str self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**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-administration/azure/keyvault/administration/_generated/v7_3/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_key_vault_client.py index def394d2d74b..6dc11fe079db 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_key_vault_client.py @@ -7,23 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin, RoleAssignmentsOperations, RoleDefinitionsOperations -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -38,29 +33,23 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): Retry-After header is present. """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None - _base_url = '{vaultBaseUrl}' + def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential + _endpoint = "{vaultBaseUrl}" self._config = KeyVaultClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.role_definitions = RoleDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.role_assignments = RoleAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + self.role_definitions = RoleDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.role_assignments = RoleAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -69,7 +58,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_metadata.json b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_metadata.json index ccb15a7cfad9..d406cdff2f89 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_metadata.json +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": false, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.core\": [\"PipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.core\": [\"AsyncPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}}" }, "global_parameters": { "sync": { @@ -65,104 +65,112 @@ "role_assignments": "RoleAssignmentsOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"LROPoller\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"AsyncLROPoller\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.polling\": [\"LROPoller\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.polling\": [\"AsyncLROPoller\"]}}}", "operations": { "_full_backup_initial" : { "sync": { - "signature": "def _full_backup_initial(\n self,\n vault_base_url, # type: str\n azure_storage_blob_container_uri=None, # type: Optional[\"_models.SASTokenParameter\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.FullBackupOperation\"\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[\"_models.SASTokenParameter\"] = None,\n **kwargs: Any\n) -\u003e \"_models.FullBackupOperation\":\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, azure_storage_blob_container_uri" + "signature": "async def _full_backup_initial(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" + } }, "begin_full_backup" : { "sync": { - "signature": "def begin_full_backup(\n self,\n vault_base_url, # type: str\n azure_storage_blob_container_uri=None, # type: Optional[\"_models.SASTokenParameter\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.FullBackupOperation\"]\n", - "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.FullBackupOperation]:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[\"_models.SASTokenParameter\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.FullBackupOperation\"]:\n", - "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, azure_storage_blob_container_uri" + "signature": "async def begin_full_backup(\n self,\n vault_base_url: str,\n azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.FullBackupOperation]:\n", + "doc": "\"\"\"Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\noperation is supported only by the Managed HSM service.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a\n valid Azure blob container where full backup needs to be stored. This token needs to be valid\n for at least next 24 hours from the time of making this call. Is either a model type or a IO\n type. Default value is None.\n:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, azure_storage_blob_container_uri, **kwargs" + } }, "full_backup_status" : { "sync": { - "signature": "def full_backup_status(\n self,\n vault_base_url, # type: str\n job_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.FullBackupOperation\"\n", - "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" }, "async": { "coroutine": true, - "signature": "async def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e \"_models.FullBackupOperation\":\n", - "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, job_id" + "signature": "async def full_backup_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.FullBackupOperation:\n", + "doc": "\"\"\"Returns the status of full backup operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The id returned as part of the backup request. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FullBackupOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" + } }, "_full_restore_operation_initial" : { "sync": { - "signature": "def _full_restore_operation_initial(\n self,\n vault_base_url, # type: str\n restore_blob_details=None, # type: Optional[\"_models.RestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.RestoreOperation\"\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[\"_models.RestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e \"_models.RestoreOperation\":\n", - "doc": "\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, restore_blob_details" + "signature": "async def _full_restore_operation_initial(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" + } }, "begin_full_restore_operation" : { "sync": { - "signature": "def begin_full_restore_operation(\n self,\n vault_base_url, # type: str\n restore_blob_details=None, # type: Optional[\"_models.RestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.RestoreOperation\"]\n", - "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.RestoreOperation]:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[\"_models.RestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.RestoreOperation\"]:\n", - "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, restore_blob_details" + "signature": "async def begin_full_restore_operation(\n self,\n vault_base_url: str,\n restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.RestoreOperation]:\n", + "doc": "\"\"\"Restores all key materials using the SAS token pointing to a previously stored Azure Blob\nstorage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of\n cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, restore_blob_details, **kwargs" + } }, "restore_status" : { "sync": { - "signature": "def restore_status(\n self,\n vault_base_url, # type: str\n job_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.RestoreOperation\"\n", - "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e \"_models.RestoreOperation\":\n", - "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, job_id" + "signature": "async def restore_status(\n self,\n vault_base_url: str,\n job_id: str,\n **kwargs: Any\n) -\u003e _models.RestoreOperation:\n", + "doc": "\"\"\"Returns the status of restore operation.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param job_id: The Job Id returned part of the restore operation. Required.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, job_id, **kwargs" + } }, "_selective_key_restore_operation_initial" : { "sync": { - "signature": "def _selective_key_restore_operation_initial(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n restore_blob_details=None, # type: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SelectiveKeyRestoreOperation\"\n", - "doc": "\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.SelectiveKeyRestoreOperation:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SelectiveKeyRestoreOperation\":\n", - "doc": "\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, restore_blob_details" + "signature": "async def _selective_key_restore_operation_initial(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e _models.SelectiveKeyRestoreOperation:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SelectiveKeyRestoreOperation or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" + } }, "begin_selective_key_restore_operation" : { "sync": { - "signature": "def begin_selective_key_restore_operation(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n restore_blob_details=None, # type: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.SelectiveKeyRestoreOperation\"]\n", - "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.SelectiveKeyRestoreOperation]:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" }, "async": { "coroutine": true, - "signature": "async def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[\"_models.SelectiveKeyRestoreOperationParameters\"] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.SelectiveKeyRestoreOperation\"]:\n", - "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\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 be restored from the user supplied backup.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, restore_blob_details" + "signature": "async def begin_selective_key_restore_operation(\n self,\n vault_base_url: str,\n key_name: str,\n restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None,\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.SelectiveKeyRestoreOperation]:\n", + "doc": "\"\"\"Restores all key versions of a given key using user supplied SAS token pointing to a previously\nstored Azure Blob storage backup folder.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to be restored from the user supplied backup. Required.\n:type key_name: str\n:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous\n successful full backup was stored. Is either a model type or a IO type. Default value is None.\n:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False\n for this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the\n result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, restore_blob_details, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_patch.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_vendor.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_vendor.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_configuration.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_configuration.py index ebf0c448e109..245a54d4fbea 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_configuration.py @@ -13,6 +13,7 @@ VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. @@ -24,28 +25,21 @@ class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-in :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str - + api_version = kwargs.pop("api_version", "7.3") # type: str self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**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-administration/azure/keyvault/administration/_generated/v7_3/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_key_vault_client.py index aa7d49f0e827..576674adf25d 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_key_vault_client.py @@ -9,16 +9,16 @@ from copy import deepcopy from typing import Any, Awaitable -from msrest import Deserializer, Serializer - from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin, RoleAssignmentsOperations, RoleDefinitionsOperations -class KeyVaultClient(KeyVaultClientOperationsMixin): + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -33,27 +33,23 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): Retry-After header is present. """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' + def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential + _endpoint = "{vaultBaseUrl}" self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.role_definitions = RoleDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.role_assignments = RoleAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.role_definitions = RoleDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.role_assignments = RoleAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -62,7 +58,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_vendor.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/__init__.py index fbdd39654293..9c2bd2964215 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/__init__.py @@ -10,8 +10,14 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._role_assignments_operations import RoleAssignmentsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', - 'RoleDefinitionsOperations', - 'RoleAssignmentsOperations', + "KeyVaultClientOperationsMixin", + "RoleDefinitionsOperations", + "RoleAssignmentsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_key_vault_client_operations.py index 8e1459d4ef07..6d7a549a4db3 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_key_vault_client_operations.py @@ -6,97 +6,134 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.polling.async_base_polling import AsyncLROBasePolling from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_full_backup_request_initial, build_full_backup_status_request, build_full_restore_operation_request_initial, build_restore_status_request, build_selective_key_restore_operation_request_initial -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_full_backup_request, + build_full_backup_status_request, + build_full_restore_operation_request, + build_restore_status_request, + build_selective_key_restore_operation_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: +class KeyVaultClientOperationsMixin(MixinABC): async def _full_backup_initial( self, vault_base_url: str, - azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, **kwargs: Any - ) -> "_models.FullBackupOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] + ) -> _models.FullBackupOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - if azure_storage_blob_container_uri is not None: - _json = self._serialize.body(azure_storage_blob_container_uri, 'SASTokenParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(azure_storage_blob_container_uri, (IO, bytes)): + _content = azure_storage_blob_container_uri else: - _json = None + if azure_storage_blob_container_uri is not None: + _json = self._serialize.body(azure_storage_blob_container_uri, "SASTokenParameter") + else: + _json = None - request = build_full_backup_request_initial( + request = build_full_backup_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_backup_initial.metadata['url'], + content=_content, + template_url=self._full_backup_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_backup_initial.metadata = {'url': "/backup"} # type: ignore - + _full_backup_initial.metadata = {"url": "/backup"} # type: ignore - @distributed_trace_async + @overload async def begin_full_backup( self, vault_base_url: str, - azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None, + azure_storage_blob_container_uri: Optional[_models.SASTokenParameter] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.FullBackupOperation"]: + ) -> AsyncLROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call. Default value is None. :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -108,101 +145,185 @@ async def begin_full_backup( :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Default value is None. + :type azure_storage_blob_container_uri: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._full_backup_initial( + raw_result = await self._full_backup_initial( # type: ignore vault_base_url=vault_base_url, azure_storage_blob_container_uri=azure_storage_blob_container_uri, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_backup.metadata = {'url': "/backup"} # type: ignore + begin_full_backup.metadata = {"url": "/backup"} # type: ignore @distributed_trace_async - async def full_backup_status( - self, - vault_base_url: str, - job_id: str, - **kwargs: Any - ) -> "_models.FullBackupOperation": + async def full_backup_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - request = build_full_backup_status_request( job_id=job_id, api_version=api_version, - template_url=self.full_backup_status.metadata['url'], + template_url=self.full_backup_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,88 +331,108 @@ async def full_backup_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - full_backup_status.metadata = {'url': "/backup/{jobId}/pending"} # type: ignore - + full_backup_status.metadata = {"url": "/backup/{jobId}/pending"} # type: ignore async def _full_restore_operation_initial( self, vault_base_url: str, - restore_blob_details: Optional["_models.RestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> "_models.RestoreOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] + ) -> _models.RestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'RestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "RestoreOperationParameters") + else: + _json = None - request = build_full_restore_operation_request_initial( + request = build_full_restore_operation_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._full_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_restore_operation_initial.metadata = {'url': "/restore"} # type: ignore - + _full_restore_operation_initial.metadata = {"url": "/restore"} # type: ignore - @distributed_trace_async + @overload async def begin_full_restore_operation( self, vault_base_url: str, - restore_blob_details: Optional["_models.RestoreOperationParameters"] = None, + restore_blob_details: Optional[_models.RestoreOperationParameters] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RestoreOperation"]: + ) -> AsyncLROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -303,101 +444,182 @@ async def begin_full_restore_operation( :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._full_restore_operation_initial( + raw_result = await self._full_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('RestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_restore_operation.metadata = {'url': "/restore"} # type: ignore + begin_full_restore_operation.metadata = {"url": "/restore"} # type: ignore @distributed_trace_async - async def restore_status( - self, - vault_base_url: str, - job_id: str, - **kwargs: Any - ) -> "_models.RestoreOperation": + async def restore_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] - request = build_restore_status_request( job_id=job_id, api_version=api_version, - template_url=self.restore_status.metadata['url'], + template_url=self.restore_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,93 +627,188 @@ async def restore_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_status.metadata = {'url': "/restore/{jobId}/pending"} # type: ignore - + restore_status.metadata = {"url": "/restore/{jobId}/pending"} # type: ignore async def _selective_key_restore_operation_initial( self, vault_base_url: str, key_name: str, - restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, **kwargs: Any - ) -> "_models.SelectiveKeyRestoreOperation": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] + ) -> _models.SelectiveKeyRestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'SelectiveKeyRestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "SelectiveKeyRestoreOperationParameters") + else: + _json = None - request = build_selective_key_restore_operation_request_initial( + request = build_selective_key_restore_operation_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._selective_key_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._selective_key_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _selective_key_restore_operation_initial.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + _selective_key_restore_operation_initial.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore + @overload + async def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[_models.SelectiveKeyRestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. - @distributed_trace_async + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload async def begin_selective_key_restore_operation( self, vault_base_url: str, key_name: str, - restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.SelectiveKeyRestoreOperation"]: + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + for this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False @@ -504,55 +821,69 @@ async def begin_selective_key_restore_operation( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._selective_key_restore_operation_initial( + raw_result = await self._selective_key_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, key_name=key_name, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncLROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_selective_key_restore_operation.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + begin_selective_key_restore_operation.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_assignments_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_assignments_operations.py index 85f3997619fe..3c5ca9407624 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_assignments_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_assignments_operations.py @@ -6,22 +6,39 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._role_assignments_operations import build_create_request, build_delete_request, build_get_request, build_list_for_scope_request -T = TypeVar('T') +from ...operations._role_assignments_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_for_scope_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RoleAssignmentsOperations: """ .. warning:: @@ -35,60 +52,61 @@ class RoleAssignmentsOperations: models = _models def __init__(self, *args, **kwargs) -> None: - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def delete( - self, - vault_base_url: str, - scope: str, - role_assignment_name: str, - **kwargs: Any - ) -> "_models.RoleAssignment": + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Deletes a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to delete. + :param scope: The scope of the role assignment to delete. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to delete. + :param role_assignment_name: The name of the role assignment to delete. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_delete_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,15 +114,76 @@ async def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + + @overload + async def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: _models.RoleAssignmentCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create( @@ -112,35 +191,51 @@ async def create( vault_base_url: str, scope: str, role_assignment_name: str, - parameters: "_models.RoleAssignmentCreateParameters", + parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any - ) -> "_models.RoleAssignment": + ) -> _models.RoleAssignment: """Creates a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to create. + :param scope: The scope of the role assignment to create. Required. :type scope: str :param role_assignment_name: The name of the role assignment to create. It can be any valid - GUID. + GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. - :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters + :param parameters: Parameters for the role assignment. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - _json = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") request = build_create_request( scope=scope, @@ -148,19 +243,21 @@ async def create( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create.metadata['url'], + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -168,63 +265,64 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace_async async def get( - self, - vault_base_url: str, - scope: str, - role_assignment_name: str, - **kwargs: Any - ) -> "_models.RoleAssignment": + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Get the specified role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment. + :param scope: The scope of the role assignment. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to get. + :param role_assignment_name: The name of the role assignment to get. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_get_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,80 +330,76 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace def list_for_scope( - self, - vault_base_url: str, - scope: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignmentListResult"]: + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.RoleAssignment"]: """Gets role assignments for a scope. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignments. + :param scope: The scope of the role assignments. Required. :type scope: str :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.RoleAssignmentListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleAssignment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.RoleAssignment] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignmentListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_for_scope_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list_for_scope.metadata['url'], + api_version=api_version, + template_url=self.list_for_scope.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -319,10 +413,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -333,8 +425,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_for_scope.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_definitions_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_definitions_operations.py index c1b21b7f6568..00cece4af518 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_definitions_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/aio/operations/_role_definitions_operations.py @@ -6,22 +6,39 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from ... import models as _models from ..._vendor import _convert_request -from ...operations._role_definitions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._role_definitions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RoleDefinitionsOperations: """ .. warning:: @@ -35,60 +52,62 @@ class RoleDefinitionsOperations: models = _models def __init__(self, *args, **kwargs) -> None: - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def delete( - self, - vault_base_url: str, - scope: str, - role_definition_name: str, - **kwargs: Any - ) -> "_models.RoleDefinition": + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Deletes a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to delete. Managed HSM only supports '/'. + Required. :type scope: str - :param role_definition_name: The name (GUID) of the role definition to delete. + :param role_definition_name: The name (GUID) of the role definition to delete. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_delete_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,15 +115,78 @@ async def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + @overload + async def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: _models.RoleDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_or_update( @@ -112,36 +194,52 @@ async def create_or_update( vault_base_url: str, scope: str, role_definition_name: str, - parameters: "_models.RoleDefinitionCreateParameters", + parameters: Union[_models.RoleDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.RoleDefinition": + ) -> _models.RoleDefinition: """Creates or updates a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to create or update. Managed HSM only supports - '/'. + '/'. Required. :type scope: str :param role_definition_name: The name of the role definition to create or update. It can be any - valid GUID. + valid GUID. Required. :type role_definition_name: str - :param parameters: Parameters for the role definition. - :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters + :param parameters: Parameters for the role definition. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleDefinitionCreateParameters") request = build_create_or_update_request( scope=scope, @@ -149,19 +247,21 @@ async def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -169,63 +269,64 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace_async async def get( - self, - vault_base_url: str, - scope: str, - role_definition_name: str, - **kwargs: Any - ) -> "_models.RoleDefinition": + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Get the specified role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition to get. Managed HSM only supports '/'. + :param scope: The scope of the role definition to get. Managed HSM only supports '/'. Required. :type scope: str - :param role_definition_name: The name of the role definition to get. + :param role_definition_name: The name of the role definition to get. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_get_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,79 +334,75 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace def list( - self, - vault_base_url: str, - scope: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleDefinitionListResult"]: + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.RoleDefinition"]: """Get all role definitions that are applicable at scope and above. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition. + :param scope: The scope of the role definition. Required. :type scope: str :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinitionListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.RoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleDefinition or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.RoleDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -319,10 +416,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -333,8 +428,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/__init__.py index 47bde45ad659..7d40b48af3ca 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/__init__.py @@ -6,82 +6,62 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import Error - from ._models_py3 import FullBackupOperation - from ._models_py3 import KeyVaultError - from ._models_py3 import Permission - from ._models_py3 import RestoreOperation - from ._models_py3 import RestoreOperationParameters - from ._models_py3 import RoleAssignment - from ._models_py3 import RoleAssignmentCreateParameters - from ._models_py3 import RoleAssignmentFilter - from ._models_py3 import RoleAssignmentListResult - from ._models_py3 import RoleAssignmentProperties - from ._models_py3 import RoleAssignmentPropertiesWithScope - from ._models_py3 import RoleDefinition - from ._models_py3 import RoleDefinitionCreateParameters - from ._models_py3 import RoleDefinitionFilter - from ._models_py3 import RoleDefinitionListResult - from ._models_py3 import RoleDefinitionProperties - from ._models_py3 import SASTokenParameter - from ._models_py3 import SelectiveKeyRestoreOperation - from ._models_py3 import SelectiveKeyRestoreOperationParameters -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import Error # type: ignore - from ._models import FullBackupOperation # type: ignore - from ._models import KeyVaultError # type: ignore - from ._models import Permission # type: ignore - from ._models import RestoreOperation # type: ignore - from ._models import RestoreOperationParameters # type: ignore - from ._models import RoleAssignment # type: ignore - from ._models import RoleAssignmentCreateParameters # type: ignore - from ._models import RoleAssignmentFilter # type: ignore - from ._models import RoleAssignmentListResult # type: ignore - from ._models import RoleAssignmentProperties # type: ignore - from ._models import RoleAssignmentPropertiesWithScope # type: ignore - from ._models import RoleDefinition # type: ignore - from ._models import RoleDefinitionCreateParameters # type: ignore - from ._models import RoleDefinitionFilter # type: ignore - from ._models import RoleDefinitionListResult # type: ignore - from ._models import RoleDefinitionProperties # type: ignore - from ._models import SASTokenParameter # type: ignore - from ._models import SelectiveKeyRestoreOperation # type: ignore - from ._models import SelectiveKeyRestoreOperationParameters # type: ignore +from ._models_py3 import Attributes +from ._models_py3 import Error +from ._models_py3 import FullBackupOperation +from ._models_py3 import KeyVaultError +from ._models_py3 import Permission +from ._models_py3 import RestoreOperation +from ._models_py3 import RestoreOperationParameters +from ._models_py3 import RoleAssignment +from ._models_py3 import RoleAssignmentCreateParameters +from ._models_py3 import RoleAssignmentFilter +from ._models_py3 import RoleAssignmentListResult +from ._models_py3 import RoleAssignmentProperties +from ._models_py3 import RoleAssignmentPropertiesWithScope +from ._models_py3 import RoleDefinition +from ._models_py3 import RoleDefinitionCreateParameters +from ._models_py3 import RoleDefinitionFilter +from ._models_py3 import RoleDefinitionListResult +from ._models_py3 import RoleDefinitionProperties +from ._models_py3 import SASTokenParameter +from ._models_py3 import SelectiveKeyRestoreOperation +from ._models_py3 import SelectiveKeyRestoreOperationParameters -from ._key_vault_client_enums import ( - DataAction, - RoleDefinitionType, - RoleScope, - RoleType, -) +from ._key_vault_client_enums import DataAction +from ._key_vault_client_enums import RoleDefinitionType +from ._key_vault_client_enums import RoleScope +from ._key_vault_client_enums import RoleType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'Error', - 'FullBackupOperation', - 'KeyVaultError', - 'Permission', - 'RestoreOperation', - 'RestoreOperationParameters', - 'RoleAssignment', - 'RoleAssignmentCreateParameters', - 'RoleAssignmentFilter', - 'RoleAssignmentListResult', - 'RoleAssignmentProperties', - 'RoleAssignmentPropertiesWithScope', - 'RoleDefinition', - 'RoleDefinitionCreateParameters', - 'RoleDefinitionFilter', - 'RoleDefinitionListResult', - 'RoleDefinitionProperties', - 'SASTokenParameter', - 'SelectiveKeyRestoreOperation', - 'SelectiveKeyRestoreOperationParameters', - 'DataAction', - 'RoleDefinitionType', - 'RoleScope', - 'RoleType', + "Attributes", + "Error", + "FullBackupOperation", + "KeyVaultError", + "Permission", + "RestoreOperation", + "RestoreOperationParameters", + "RoleAssignment", + "RoleAssignmentCreateParameters", + "RoleAssignmentFilter", + "RoleAssignmentListResult", + "RoleAssignmentProperties", + "RoleAssignmentPropertiesWithScope", + "RoleDefinition", + "RoleDefinitionCreateParameters", + "RoleDefinitionFilter", + "RoleDefinitionListResult", + "RoleDefinitionProperties", + "SASTokenParameter", + "SelectiveKeyRestoreOperation", + "SelectiveKeyRestoreOperationParameters", + "DataAction", + "RoleDefinitionType", + "RoleScope", + "RoleType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_key_vault_client_enums.py index 139d3bcf16a0..337512a325b1 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_key_vault_client_enums.py @@ -7,13 +7,11 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Supported permissions for data actions. - """ +class DataAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported permissions for data actions.""" #: Read HSM key metadata. READ_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/read/action" @@ -84,24 +82,24 @@ class DataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Generate random numbers. RANDOM_NUMBERS_GENERATE = "Microsoft.KeyVault/managedHsm/rng/action" -class RoleDefinitionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role definition type. - """ + +class RoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role definition type.""" MICROSOFT_AUTHORIZATION_ROLE_DEFINITIONS = "Microsoft.Authorization/roleDefinitions" -class RoleScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role scope. - """ - #: Global scope. - GLOBAL_ENUM = "/" - #: Keys scope. +class RoleScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role scope.""" + + #: Global scope + GLOBAL = "/" + #: Keys scope KEYS = "/keys" -class RoleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The role type. - """ + +class RoleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role type.""" #: Built in role. BUILT_IN_ROLE = "AKVBuiltInRole" diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models.py deleted file mode 100644 index 8353aeb9ed82..000000000000 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models.py +++ /dev/null @@ -1,841 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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_3.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 FullBackupOperation(msrest.serialization.Model): - """Full backup operation. - - :ivar status: Status of the backup operation. - :vartype status: str - :ivar status_details: The status details of backup operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the full backup operation. - :vartype error: ~azure.keyvault.v7_3.models.Error - :ivar start_time: The start time of the backup operation in UTC. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the backup operation in UTC. - :vartype end_time: ~datetime.datetime - :ivar job_id: Identifier for the full backup operation. - :vartype job_id: str - :ivar azure_storage_blob_container_uri: The Azure blob storage container Uri which contains the - full backup. - :vartype azure_storage_blob_container_uri: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'azure_storage_blob_container_uri': {'key': 'azureStorageBlobContainerUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the backup operation. - :paramtype status: str - :keyword status_details: The status details of backup operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the full backup operation. - :paramtype error: ~azure.keyvault.v7_3.models.Error - :keyword start_time: The start time of the backup operation in UTC. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the backup operation in UTC. - :paramtype end_time: ~datetime.datetime - :keyword job_id: Identifier for the full backup operation. - :paramtype job_id: str - :keyword azure_storage_blob_container_uri: The Azure blob storage container Uri which contains - the full backup. - :paramtype azure_storage_blob_container_uri: str - """ - super(FullBackupOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.job_id = kwargs.get('job_id', None) - self.azure_storage_blob_container_uri = kwargs.get('azure_storage_blob_container_uri', 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_3.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 Permission(msrest.serialization.Model): - """Role definition permissions. - - :ivar actions: Action permissions that are granted. - :vartype actions: list[str] - :ivar not_actions: Action permissions that are excluded but not denied. They may be granted by - other role definitions assigned to a principal. - :vartype not_actions: list[str] - :ivar data_actions: Data action permissions that are granted. - :vartype data_actions: list[str or ~azure.keyvault.v7_3.models.DataAction] - :ivar not_data_actions: Data action permissions that are excluded but not denied. They may be - granted by other role definitions assigned to a principal. - :vartype not_data_actions: list[str or ~azure.keyvault.v7_3.models.DataAction] - """ - - _attribute_map = { - 'actions': {'key': 'actions', 'type': '[str]'}, - 'not_actions': {'key': 'notActions', 'type': '[str]'}, - 'data_actions': {'key': 'dataActions', 'type': '[str]'}, - 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword actions: Action permissions that are granted. - :paramtype actions: list[str] - :keyword not_actions: Action permissions that are excluded but not denied. They may be granted - by other role definitions assigned to a principal. - :paramtype not_actions: list[str] - :keyword data_actions: Data action permissions that are granted. - :paramtype data_actions: list[str or ~azure.keyvault.v7_3.models.DataAction] - :keyword not_data_actions: Data action permissions that are excluded but not denied. They may - be granted by other role definitions assigned to a principal. - :paramtype not_data_actions: list[str or ~azure.keyvault.v7_3.models.DataAction] - """ - super(Permission, self).__init__(**kwargs) - self.actions = kwargs.get('actions', None) - self.not_actions = kwargs.get('not_actions', None) - self.data_actions = kwargs.get('data_actions', None) - self.not_data_actions = kwargs.get('not_data_actions', None) - - -class RestoreOperation(msrest.serialization.Model): - """Restore operation. - - :ivar status: Status of the restore operation. - :vartype status: str - :ivar status_details: The status details of restore operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the restore operation. - :vartype error: ~azure.keyvault.v7_3.models.Error - :ivar job_id: Identifier for the restore operation. - :vartype job_id: str - :ivar start_time: The start time of the restore operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the restore operation. - :vartype end_time: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the restore operation. - :paramtype status: str - :keyword status_details: The status details of restore operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the restore operation. - :paramtype error: ~azure.keyvault.v7_3.models.Error - :keyword job_id: Identifier for the restore operation. - :paramtype job_id: str - :keyword start_time: The start time of the restore operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the restore operation. - :paramtype end_time: ~datetime.datetime - """ - super(RestoreOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.job_id = kwargs.get('job_id', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class RestoreOperationParameters(msrest.serialization.Model): - """RestoreOperationParameters. - - All required parameters must be populated in order to send to Azure. - - :ivar sas_token_parameters: Required. - :vartype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :ivar folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. - :vartype folder_to_restore: str - """ - - _validation = { - 'sas_token_parameters': {'required': True}, - 'folder_to_restore': {'required': True}, - } - - _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder_to_restore': {'key': 'folderToRestore', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword sas_token_parameters: Required. - :paramtype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :keyword folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. - :paramtype folder_to_restore: str - """ - super(RestoreOperationParameters, self).__init__(**kwargs) - self.sas_token_parameters = kwargs['sas_token_parameters'] - self.folder_to_restore = kwargs['folder_to_restore'] - - -class RoleAssignment(msrest.serialization.Model): - """Role Assignments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role assignment ID. - :vartype id: str - :ivar name: The role assignment name. - :vartype name: str - :ivar type: The role assignment type. - :vartype type: str - :ivar properties: Role assignment properties. - :vartype properties: ~azure.keyvault.v7_3.models.RoleAssignmentPropertiesWithScope - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Role assignment properties. - :paramtype properties: ~azure.keyvault.v7_3.models.RoleAssignmentPropertiesWithScope - """ - super(RoleAssignment, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class RoleAssignmentCreateParameters(msrest.serialization.Model): - """Role assignment create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Required. Role assignment properties. - :vartype properties: ~azure.keyvault.v7_3.models.RoleAssignmentProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Required. Role assignment properties. - :paramtype properties: ~azure.keyvault.v7_3.models.RoleAssignmentProperties - """ - super(RoleAssignmentCreateParameters, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RoleAssignmentFilter(msrest.serialization.Model): - """Role Assignments filter. - - :ivar principal_id: Returns role assignment of the specific principal. - :vartype principal_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword principal_id: Returns role assignment of the specific principal. - :paramtype principal_id: str - """ - super(RoleAssignmentFilter, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - - -class RoleAssignmentListResult(msrest.serialization.Model): - """Role assignment list operation result. - - :ivar value: Role assignment list. - :vartype value: list[~azure.keyvault.v7_3.models.RoleAssignment] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleAssignment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Role assignment list. - :paramtype value: list[~azure.keyvault.v7_3.models.RoleAssignment] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super(RoleAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RoleAssignmentProperties(msrest.serialization.Model): - """Role assignment properties. - - All required parameters must be populated in order to send to Azure. - - :ivar role_definition_id: Required. The role definition ID used in the role assignment. - :vartype role_definition_id: str - :ivar principal_id: Required. The principal ID assigned to the role. This maps to the ID inside - the Active Directory. It can point to a user, service principal, or security group. - :vartype principal_id: str - """ - - _validation = { - 'role_definition_id': {'required': True}, - 'principal_id': {'required': True}, - } - - _attribute_map = { - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_definition_id: Required. The role definition ID used in the role assignment. - :paramtype role_definition_id: str - :keyword principal_id: Required. The principal ID assigned to the role. This maps to the ID - inside the Active Directory. It can point to a user, service principal, or security group. - :paramtype principal_id: str - """ - super(RoleAssignmentProperties, self).__init__(**kwargs) - self.role_definition_id = kwargs['role_definition_id'] - self.principal_id = kwargs['principal_id'] - - -class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): - """Role assignment properties with scope. - - :ivar scope: The role scope. Possible values include: "/", "/keys". - :vartype scope: str or ~azure.keyvault.v7_3.models.RoleScope - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - """ - - _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword scope: The role scope. Possible values include: "/", "/keys". - :paramtype scope: str or ~azure.keyvault.v7_3.models.RoleScope - :keyword role_definition_id: The role definition ID. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. - :paramtype principal_id: str - """ - super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) - self.scope = kwargs.get('scope', None) - self.role_definition_id = kwargs.get('role_definition_id', None) - self.principal_id = kwargs.get('principal_id', None) - - -class RoleDefinition(msrest.serialization.Model): - """Role definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role definition ID. - :vartype id: str - :ivar name: The role definition name. - :vartype name: str - :ivar type: The role definition type. Possible values include: - "Microsoft.Authorization/roleDefinitions". - :vartype type: str or ~azure.keyvault.v7_3.models.RoleDefinitionType - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :vartype role_type: str or ~azure.keyvault.v7_3.models.RoleType - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.keyvault.v7_3.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'role_type': {'key': 'properties.type', 'type': 'str'}, - 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :paramtype role_type: str or ~azure.keyvault.v7_3.models.RoleType - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.keyvault.v7_3.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] - """ - super(RoleDefinition, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.role_name = kwargs.get('role_name', None) - self.description = kwargs.get('description', None) - self.role_type = kwargs.get('role_type', None) - self.permissions = kwargs.get('permissions', None) - self.assignable_scopes = kwargs.get('assignable_scopes', None) - - -class RoleDefinitionCreateParameters(msrest.serialization.Model): - """Role definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar properties: Required. Role definition properties. - :vartype properties: ~azure.keyvault.v7_3.models.RoleDefinitionProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: Required. Role definition properties. - :paramtype properties: ~azure.keyvault.v7_3.models.RoleDefinitionProperties - """ - super(RoleDefinitionCreateParameters, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RoleDefinitionFilter(msrest.serialization.Model): - """Role Definitions filter. - - :ivar role_name: Returns role definition with the specific name. - :vartype role_name: str - """ - - _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: Returns role definition with the specific name. - :paramtype role_name: str - """ - super(RoleDefinitionFilter, self).__init__(**kwargs) - self.role_name = kwargs.get('role_name', None) - - -class RoleDefinitionListResult(msrest.serialization.Model): - """Role definition list operation result. - - :ivar value: Role definition list. - :vartype value: list[~azure.keyvault.v7_3.models.RoleDefinition] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Role definition list. - :paramtype value: list[~azure.keyvault.v7_3.models.RoleDefinition] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super(RoleDefinitionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RoleDefinitionProperties(msrest.serialization.Model): - """Role definition properties. - - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :vartype role_type: str or ~azure.keyvault.v7_3.models.RoleType - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.keyvault.v7_3.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] - """ - - _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'role_type': {'key': 'type', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". - :paramtype role_type: str or ~azure.keyvault.v7_3.models.RoleType - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.keyvault.v7_3.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] - """ - super(RoleDefinitionProperties, self).__init__(**kwargs) - self.role_name = kwargs.get('role_name', None) - self.description = kwargs.get('description', None) - self.role_type = kwargs.get('role_type', None) - self.permissions = kwargs.get('permissions', None) - self.assignable_scopes = kwargs.get('assignable_scopes', None) - - -class SASTokenParameter(msrest.serialization.Model): - """SASTokenParameter. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_resource_uri: Required. Azure Blob storage container Uri. - :vartype storage_resource_uri: str - :ivar token: Required. The SAS token pointing to an Azure Blob storage container. - :vartype token: str - """ - - _validation = { - 'storage_resource_uri': {'required': True}, - 'token': {'required': True}, - } - - _attribute_map = { - 'storage_resource_uri': {'key': 'storageResourceUri', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword storage_resource_uri: Required. Azure Blob storage container Uri. - :paramtype storage_resource_uri: str - :keyword token: Required. The SAS token pointing to an Azure Blob storage container. - :paramtype token: str - """ - super(SASTokenParameter, self).__init__(**kwargs) - self.storage_resource_uri = kwargs['storage_resource_uri'] - self.token = kwargs['token'] - - -class SelectiveKeyRestoreOperation(msrest.serialization.Model): - """Selective Key Restore operation. - - :ivar status: Status of the restore operation. - :vartype status: str - :ivar status_details: The status details of restore operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the selective key restore operation. - :vartype error: ~azure.keyvault.v7_3.models.Error - :ivar job_id: Identifier for the selective key restore operation. - :vartype job_id: str - :ivar start_time: The start time of the restore operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the restore operation. - :vartype end_time: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the restore operation. - :paramtype status: str - :keyword status_details: The status details of restore operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the selective key restore operation. - :paramtype error: ~azure.keyvault.v7_3.models.Error - :keyword job_id: Identifier for the selective key restore operation. - :paramtype job_id: str - :keyword start_time: The start time of the restore operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the restore operation. - :paramtype end_time: ~datetime.datetime - """ - super(SelectiveKeyRestoreOperation, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.status_details = kwargs.get('status_details', None) - self.error = kwargs.get('error', None) - self.job_id = kwargs.get('job_id', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class SelectiveKeyRestoreOperationParameters(msrest.serialization.Model): - """SelectiveKeyRestoreOperationParameters. - - All required parameters must be populated in order to send to Azure. - - :ivar sas_token_parameters: Required. - :vartype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :ivar folder: Required. The Folder name of the blob where the previous successful full backup - was stored. - :vartype folder: str - """ - - _validation = { - 'sas_token_parameters': {'required': True}, - 'folder': {'required': True}, - } - - _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder': {'key': 'folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword sas_token_parameters: Required. - :paramtype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :keyword folder: Required. The Folder name of the blob where the previous successful full - backup was stored. - :paramtype folder: str - """ - super(SelectiveKeyRestoreOperationParameters, self).__init__(**kwargs) - self.sas_token_parameters = kwargs['sas_token_parameters'] - self.folder = kwargs['folder'] diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models_py3.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models_py3.py index a1373409babb..5f671dc4374c 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, Union +from typing import List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): +class Attributes(_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. @@ -33,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -61,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -69,7 +71,7 @@ def __init__( self.updated = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -83,30 +85,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class FullBackupOperation(msrest.serialization.Model): +class FullBackupOperation(_serialization.Model): """Full backup operation. :ivar status: Status of the backup operation. @@ -127,13 +125,13 @@ class FullBackupOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'azure_storage_blob_container_uri': {'key': 'azureStorageBlobContainerUri', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, + "job_id": {"key": "jobId", "type": "str"}, + "azure_storage_blob_container_uri": {"key": "azureStorageBlobContainerUri", "type": "str"}, } def __init__( @@ -141,7 +139,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, job_id: Optional[str] = None, @@ -165,7 +163,7 @@ def __init__( the full backup. :paramtype azure_storage_blob_container_uri: str """ - super(FullBackupOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -175,7 +173,7 @@ def __init__( self.azure_storage_blob_container_uri = azure_storage_blob_container_uri -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -185,24 +183,20 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class Permission(msrest.serialization.Model): +class Permission(_serialization.Model): """Role definition permissions. :ivar actions: Action permissions that are granted. @@ -218,10 +212,10 @@ class Permission(msrest.serialization.Model): """ _attribute_map = { - 'actions': {'key': 'actions', 'type': '[str]'}, - 'not_actions': {'key': 'notActions', 'type': '[str]'}, - 'data_actions': {'key': 'dataActions', 'type': '[str]'}, - 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, + "actions": {"key": "actions", "type": "[str]"}, + "not_actions": {"key": "notActions", "type": "[str]"}, + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, } def __init__( @@ -229,8 +223,8 @@ def __init__( *, actions: Optional[List[str]] = None, not_actions: Optional[List[str]] = None, - data_actions: Optional[List[Union[str, "DataAction"]]] = None, - not_data_actions: Optional[List[Union[str, "DataAction"]]] = None, + data_actions: Optional[List[Union[str, "_models.DataAction"]]] = None, + not_data_actions: Optional[List[Union[str, "_models.DataAction"]]] = None, **kwargs ): """ @@ -245,14 +239,14 @@ def __init__( be granted by other role definitions assigned to a principal. :paramtype not_data_actions: list[str or ~azure.keyvault.v7_3.models.DataAction] """ - super(Permission, self).__init__(**kwargs) + super().__init__(**kwargs) self.actions = actions self.not_actions = not_actions self.data_actions = data_actions self.not_data_actions = not_data_actions -class RestoreOperation(msrest.serialization.Model): +class RestoreOperation(_serialization.Model): """Restore operation. :ivar status: Status of the restore operation. @@ -270,12 +264,12 @@ class RestoreOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, } def __init__( @@ -283,7 +277,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, @@ -303,7 +297,7 @@ def __init__( :keyword end_time: The end time of the restore operation. :paramtype end_time: ~datetime.datetime """ - super(RestoreOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -312,48 +306,42 @@ def __init__( self.end_time = end_time -class RestoreOperationParameters(msrest.serialization.Model): +class RestoreOperationParameters(_serialization.Model): """RestoreOperationParameters. All required parameters must be populated in order to send to Azure. :ivar sas_token_parameters: Required. :vartype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :ivar folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. + :ivar folder_to_restore: The Folder name of the blob where the previous successful full backup + was stored. Required. :vartype folder_to_restore: str """ _validation = { - 'sas_token_parameters': {'required': True}, - 'folder_to_restore': {'required': True}, + "sas_token_parameters": {"required": True}, + "folder_to_restore": {"required": True}, } _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder_to_restore': {'key': 'folderToRestore', 'type': 'str'}, + "sas_token_parameters": {"key": "sasTokenParameters", "type": "SASTokenParameter"}, + "folder_to_restore": {"key": "folderToRestore", "type": "str"}, } - def __init__( - self, - *, - sas_token_parameters: "SASTokenParameter", - folder_to_restore: str, - **kwargs - ): + def __init__(self, *, sas_token_parameters: "_models.SASTokenParameter", folder_to_restore: str, **kwargs): """ :keyword sas_token_parameters: Required. :paramtype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :keyword folder_to_restore: Required. The Folder name of the blob where the previous successful - full backup was stored. + :keyword folder_to_restore: The Folder name of the blob where the previous successful full + backup was stored. Required. :paramtype folder_to_restore: str """ - super(RestoreOperationParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.sas_token_parameters = sas_token_parameters self.folder_to_restore = folder_to_restore -class RoleAssignment(msrest.serialization.Model): +class RoleAssignment(_serialization.Model): """Role Assignments. Variables are only populated by the server, and will be ignored when sending a request. @@ -369,67 +357,57 @@ class RoleAssignment(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "RoleAssignmentPropertiesWithScope"}, } - def __init__( - self, - *, - properties: Optional["RoleAssignmentPropertiesWithScope"] = None, - **kwargs - ): + def __init__(self, *, properties: Optional["_models.RoleAssignmentPropertiesWithScope"] = None, **kwargs): """ :keyword properties: Role assignment properties. :paramtype properties: ~azure.keyvault.v7_3.models.RoleAssignmentPropertiesWithScope """ - super(RoleAssignment, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.properties = properties -class RoleAssignmentCreateParameters(msrest.serialization.Model): +class RoleAssignmentCreateParameters(_serialization.Model): """Role assignment create parameters. All required parameters must be populated in order to send to Azure. - :ivar properties: Required. Role assignment properties. + :ivar properties: Role assignment properties. Required. :vartype properties: ~azure.keyvault.v7_3.models.RoleAssignmentProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, + "properties": {"key": "properties", "type": "RoleAssignmentProperties"}, } - def __init__( - self, - *, - properties: "RoleAssignmentProperties", - **kwargs - ): + def __init__(self, *, properties: "_models.RoleAssignmentProperties", **kwargs): """ - :keyword properties: Required. Role assignment properties. + :keyword properties: Role assignment properties. Required. :paramtype properties: ~azure.keyvault.v7_3.models.RoleAssignmentProperties """ - super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties -class RoleAssignmentFilter(msrest.serialization.Model): +class RoleAssignmentFilter(_serialization.Model): """Role Assignments filter. :ivar principal_id: Returns role assignment of the specific principal. @@ -437,24 +415,19 @@ class RoleAssignmentFilter(msrest.serialization.Model): """ _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, } - def __init__( - self, - *, - principal_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, principal_id: Optional[str] = None, **kwargs): """ :keyword principal_id: Returns role assignment of the specific principal. :paramtype principal_id: str """ - super(RoleAssignmentFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = principal_id -class RoleAssignmentListResult(msrest.serialization.Model): +class RoleAssignmentListResult(_serialization.Model): """Role assignment list operation result. :ivar value: Role assignment list. @@ -464,16 +437,12 @@ class RoleAssignmentListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleAssignment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RoleAssignment]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RoleAssignment"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RoleAssignment"]] = None, next_link: Optional[str] = None, **kwargs ): """ :keyword value: Role assignment list. @@ -481,56 +450,50 @@ def __init__( :keyword next_link: The URL to use for getting the next set of results. :paramtype next_link: str """ - super(RoleAssignmentListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RoleAssignmentProperties(msrest.serialization.Model): +class RoleAssignmentProperties(_serialization.Model): """Role assignment properties. All required parameters must be populated in order to send to Azure. - :ivar role_definition_id: Required. The role definition ID used in the role assignment. + :ivar role_definition_id: The role definition ID used in the role assignment. Required. :vartype role_definition_id: str - :ivar principal_id: Required. The principal ID assigned to the role. This maps to the ID inside - the Active Directory. It can point to a user, service principal, or security group. + :ivar principal_id: The principal ID assigned to the role. This maps to the ID inside the + Active Directory. It can point to a user, service principal, or security group. Required. :vartype principal_id: str """ _validation = { - 'role_definition_id': {'required': True}, - 'principal_id': {'required': True}, + "role_definition_id": {"required": True}, + "principal_id": {"required": True}, } _attribute_map = { - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, } - def __init__( - self, - *, - role_definition_id: str, - principal_id: str, - **kwargs - ): + def __init__(self, *, role_definition_id: str, principal_id: str, **kwargs): """ - :keyword role_definition_id: Required. The role definition ID used in the role assignment. + :keyword role_definition_id: The role definition ID used in the role assignment. Required. :paramtype role_definition_id: str - :keyword principal_id: Required. The principal ID assigned to the role. This maps to the ID - inside the Active Directory. It can point to a user, service principal, or security group. + :keyword principal_id: The principal ID assigned to the role. This maps to the ID inside the + Active Directory. It can point to a user, service principal, or security group. Required. :paramtype principal_id: str """ - super(RoleAssignmentProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_definition_id = role_definition_id self.principal_id = principal_id -class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): +class RoleAssignmentPropertiesWithScope(_serialization.Model): """Role assignment properties with scope. - :ivar scope: The role scope. Possible values include: "/", "/keys". + :ivar scope: The role scope. Known values are: "/" and "/keys". :vartype scope: str or ~azure.keyvault.v7_3.models.RoleScope :ivar role_definition_id: The role definition ID. :vartype role_definition_id: str @@ -539,34 +502,34 @@ class RoleAssignmentPropertiesWithScope(msrest.serialization.Model): """ _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, + "scope": {"key": "scope", "type": "str"}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, } def __init__( self, *, - scope: Optional[Union[str, "RoleScope"]] = None, + scope: Optional[Union[str, "_models.RoleScope"]] = None, role_definition_id: Optional[str] = None, principal_id: Optional[str] = None, **kwargs ): """ - :keyword scope: The role scope. Possible values include: "/", "/keys". + :keyword scope: The role scope. Known values are: "/" and "/keys". :paramtype scope: str or ~azure.keyvault.v7_3.models.RoleScope :keyword role_definition_id: The role definition ID. :paramtype role_definition_id: str :keyword principal_id: The principal ID. :paramtype principal_id: str """ - super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) + super().__init__(**kwargs) self.scope = scope self.role_definition_id = role_definition_id self.principal_id = principal_id -class RoleDefinition(msrest.serialization.Model): +class RoleDefinition(_serialization.Model): """Role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -575,14 +538,13 @@ class RoleDefinition(msrest.serialization.Model): :vartype id: str :ivar name: The role definition name. :vartype name: str - :ivar type: The role definition type. Possible values include: - "Microsoft.Authorization/roleDefinitions". + :ivar type: The role definition type. "Microsoft.Authorization/roleDefinitions" :vartype type: str or ~azure.keyvault.v7_3.models.RoleDefinitionType :ivar role_name: The role name. :vartype role_name: str :ivar description: The role definition description. :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :ivar role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :vartype role_type: str or ~azure.keyvault.v7_3.models.RoleType :ivar permissions: Role definition permissions. :vartype permissions: list[~azure.keyvault.v7_3.models.Permission] @@ -591,20 +553,20 @@ class RoleDefinition(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'role_name': {'key': 'properties.roleName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'role_type': {'key': 'properties.type', 'type': 'str'}, - 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "role_name": {"key": "properties.roleName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "role_type": {"key": "properties.type", "type": "str"}, + "permissions": {"key": "properties.permissions", "type": "[Permission]"}, + "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, } def __init__( @@ -612,9 +574,9 @@ def __init__( *, role_name: Optional[str] = None, description: Optional[str] = None, - role_type: Optional[Union[str, "RoleType"]] = None, - permissions: Optional[List["Permission"]] = None, - assignable_scopes: Optional[List[Union[str, "RoleScope"]]] = None, + role_type: Optional[Union[str, "_models.RoleType"]] = None, + permissions: Optional[List["_models.Permission"]] = None, + assignable_scopes: Optional[List[Union[str, "_models.RoleScope"]]] = None, **kwargs ): """ @@ -622,14 +584,14 @@ def __init__( :paramtype role_name: str :keyword description: The role definition description. :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :keyword role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :paramtype role_type: str or ~azure.keyvault.v7_3.models.RoleType :keyword permissions: Role definition permissions. :paramtype permissions: list[~azure.keyvault.v7_3.models.Permission] :keyword assignable_scopes: Role definition assignable scopes. :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] """ - super(RoleDefinition, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -640,38 +602,33 @@ def __init__( self.assignable_scopes = assignable_scopes -class RoleDefinitionCreateParameters(msrest.serialization.Model): +class RoleDefinitionCreateParameters(_serialization.Model): """Role definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar properties: Required. Role definition properties. + :ivar properties: Role definition properties. Required. :vartype properties: ~azure.keyvault.v7_3.models.RoleDefinitionProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, + "properties": {"key": "properties", "type": "RoleDefinitionProperties"}, } - def __init__( - self, - *, - properties: "RoleDefinitionProperties", - **kwargs - ): + def __init__(self, *, properties: "_models.RoleDefinitionProperties", **kwargs): """ - :keyword properties: Required. Role definition properties. + :keyword properties: Role definition properties. Required. :paramtype properties: ~azure.keyvault.v7_3.models.RoleDefinitionProperties """ - super(RoleDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.properties = properties -class RoleDefinitionFilter(msrest.serialization.Model): +class RoleDefinitionFilter(_serialization.Model): """Role Definitions filter. :ivar role_name: Returns role definition with the specific name. @@ -679,24 +636,19 @@ class RoleDefinitionFilter(msrest.serialization.Model): """ _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, + "role_name": {"key": "roleName", "type": "str"}, } - def __init__( - self, - *, - role_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, role_name: Optional[str] = None, **kwargs): """ :keyword role_name: Returns role definition with the specific name. :paramtype role_name: str """ - super(RoleDefinitionFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_name = role_name -class RoleDefinitionListResult(msrest.serialization.Model): +class RoleDefinitionListResult(_serialization.Model): """Role definition list operation result. :ivar value: Role definition list. @@ -706,16 +658,12 @@ class RoleDefinitionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RoleDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RoleDefinition"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs ): """ :keyword value: Role definition list. @@ -723,19 +671,19 @@ def __init__( :keyword next_link: The URL to use for getting the next set of results. :paramtype next_link: str """ - super(RoleDefinitionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RoleDefinitionProperties(msrest.serialization.Model): +class RoleDefinitionProperties(_serialization.Model): """Role definition properties. :ivar role_name: The role name. :vartype role_name: str :ivar description: The role definition description. :vartype description: str - :ivar role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :ivar role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :vartype role_type: str or ~azure.keyvault.v7_3.models.RoleType :ivar permissions: Role definition permissions. :vartype permissions: list[~azure.keyvault.v7_3.models.Permission] @@ -744,11 +692,11 @@ class RoleDefinitionProperties(msrest.serialization.Model): """ _attribute_map = { - 'role_name': {'key': 'roleName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'role_type': {'key': 'type', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': '[Permission]'}, - 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, + "role_name": {"key": "roleName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "role_type": {"key": "type", "type": "str"}, + "permissions": {"key": "permissions", "type": "[Permission]"}, + "assignable_scopes": {"key": "assignableScopes", "type": "[str]"}, } def __init__( @@ -756,9 +704,9 @@ def __init__( *, role_name: Optional[str] = None, description: Optional[str] = None, - role_type: Optional[Union[str, "RoleType"]] = None, - permissions: Optional[List["Permission"]] = None, - assignable_scopes: Optional[List[Union[str, "RoleScope"]]] = None, + role_type: Optional[Union[str, "_models.RoleType"]] = None, + permissions: Optional[List["_models.Permission"]] = None, + assignable_scopes: Optional[List[Union[str, "_models.RoleScope"]]] = None, **kwargs ): """ @@ -766,14 +714,14 @@ def __init__( :paramtype role_name: str :keyword description: The role definition description. :paramtype description: str - :keyword role_type: The role type. Possible values include: "AKVBuiltInRole", "CustomRole". + :keyword role_type: The role type. Known values are: "AKVBuiltInRole" and "CustomRole". :paramtype role_type: str or ~azure.keyvault.v7_3.models.RoleType :keyword permissions: Role definition permissions. :paramtype permissions: list[~azure.keyvault.v7_3.models.Permission] :keyword assignable_scopes: Role definition assignable scopes. :paramtype assignable_scopes: list[str or ~azure.keyvault.v7_3.models.RoleScope] """ - super(RoleDefinitionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.role_name = role_name self.description = description self.role_type = role_type @@ -781,46 +729,40 @@ def __init__( self.assignable_scopes = assignable_scopes -class SASTokenParameter(msrest.serialization.Model): +class SASTokenParameter(_serialization.Model): """SASTokenParameter. All required parameters must be populated in order to send to Azure. - :ivar storage_resource_uri: Required. Azure Blob storage container Uri. + :ivar storage_resource_uri: Azure Blob storage container Uri. Required. :vartype storage_resource_uri: str - :ivar token: Required. The SAS token pointing to an Azure Blob storage container. + :ivar token: The SAS token pointing to an Azure Blob storage container. Required. :vartype token: str """ _validation = { - 'storage_resource_uri': {'required': True}, - 'token': {'required': True}, + "storage_resource_uri": {"required": True}, + "token": {"required": True}, } _attribute_map = { - 'storage_resource_uri': {'key': 'storageResourceUri', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, + "storage_resource_uri": {"key": "storageResourceUri", "type": "str"}, + "token": {"key": "token", "type": "str"}, } - def __init__( - self, - *, - storage_resource_uri: str, - token: str, - **kwargs - ): + def __init__(self, *, storage_resource_uri: str, token: str, **kwargs): """ - :keyword storage_resource_uri: Required. Azure Blob storage container Uri. + :keyword storage_resource_uri: Azure Blob storage container Uri. Required. :paramtype storage_resource_uri: str - :keyword token: Required. The SAS token pointing to an Azure Blob storage container. + :keyword token: The SAS token pointing to an Azure Blob storage container. Required. :paramtype token: str """ - super(SASTokenParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_resource_uri = storage_resource_uri self.token = token -class SelectiveKeyRestoreOperation(msrest.serialization.Model): +class SelectiveKeyRestoreOperation(_serialization.Model): """Selective Key Restore operation. :ivar status: Status of the restore operation. @@ -838,12 +780,12 @@ class SelectiveKeyRestoreOperation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'unix-time'}, - 'end_time': {'key': 'endTime', 'type': 'unix-time'}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "unix-time"}, + "end_time": {"key": "endTime", "type": "unix-time"}, } def __init__( @@ -851,7 +793,7 @@ def __init__( *, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, @@ -871,7 +813,7 @@ def __init__( :keyword end_time: The end time of the restore operation. :paramtype end_time: ~datetime.datetime """ - super(SelectiveKeyRestoreOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.status_details = status_details self.error = error @@ -880,42 +822,36 @@ def __init__( self.end_time = end_time -class SelectiveKeyRestoreOperationParameters(msrest.serialization.Model): +class SelectiveKeyRestoreOperationParameters(_serialization.Model): """SelectiveKeyRestoreOperationParameters. All required parameters must be populated in order to send to Azure. :ivar sas_token_parameters: Required. :vartype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :ivar folder: Required. The Folder name of the blob where the previous successful full backup - was stored. + :ivar folder: The Folder name of the blob where the previous successful full backup was stored. + Required. :vartype folder: str """ _validation = { - 'sas_token_parameters': {'required': True}, - 'folder': {'required': True}, + "sas_token_parameters": {"required": True}, + "folder": {"required": True}, } _attribute_map = { - 'sas_token_parameters': {'key': 'sasTokenParameters', 'type': 'SASTokenParameter'}, - 'folder': {'key': 'folder', 'type': 'str'}, + "sas_token_parameters": {"key": "sasTokenParameters", "type": "SASTokenParameter"}, + "folder": {"key": "folder", "type": "str"}, } - def __init__( - self, - *, - sas_token_parameters: "SASTokenParameter", - folder: str, - **kwargs - ): + def __init__(self, *, sas_token_parameters: "_models.SASTokenParameter", folder: str, **kwargs): """ :keyword sas_token_parameters: Required. :paramtype sas_token_parameters: ~azure.keyvault.v7_3.models.SASTokenParameter - :keyword folder: Required. The Folder name of the blob where the previous successful full - backup was stored. + :keyword folder: The Folder name of the blob where the previous successful full backup was + stored. Required. :paramtype folder: str """ - super(SelectiveKeyRestoreOperationParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.sas_token_parameters = sas_token_parameters self.folder = folder diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/__init__.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/__init__.py index fbdd39654293..9c2bd2964215 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/__init__.py @@ -10,8 +10,14 @@ from ._role_definitions_operations import RoleDefinitionsOperations from ._role_assignments_operations import RoleAssignmentsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', - 'RoleDefinitionsOperations', - 'RoleAssignmentsOperations', + "KeyVaultClientOperationsMixin", + "RoleDefinitionsOperations", + "RoleAssignmentsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_key_vault_client_operations.py index 087033b90aaa..6c28e40462b4 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_key_vault_client_operations.py @@ -6,270 +6,249 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.polling.base_polling import LROBasePolling from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_full_backup_request_initial( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_full_backup_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/backup") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_full_backup_status_request( - job_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_full_backup_status_request(job_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/backup/{jobId}/pending") path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_full_restore_operation_request_initial( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_full_restore_operation_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_status_request( - job_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_status_request(job_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/restore/{jobId}/pending") path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, 'str'), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_selective_key_restore_operation_request_initial( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_selective_key_restore_operation_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{keyName}/restore") path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): +class KeyVaultClientOperationsMixin(MixinABC): def _full_backup_initial( self, - vault_base_url, # type: str - azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"] - **kwargs # type: Any - ): - # type: (...) -> "_models.FullBackupOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> _models.FullBackupOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - if azure_storage_blob_container_uri is not None: - _json = self._serialize.body(azure_storage_blob_container_uri, 'SASTokenParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(azure_storage_blob_container_uri, (IO, bytes)): + _content = azure_storage_blob_container_uri else: - _json = None + if azure_storage_blob_container_uri is not None: + _json = self._serialize.body(azure_storage_blob_container_uri, "SASTokenParameter") + else: + _json = None - request = build_full_backup_request_initial( + request = build_full_backup_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_backup_initial.metadata['url'], + content=_content, + template_url=self._full_backup_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_backup_initial.metadata = {'url': "/backup"} # type: ignore + _full_backup_initial.metadata = {"url": "/backup"} # type: ignore - - @distributed_trace + @overload def begin_full_backup( self, - vault_base_url, # type: str - azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FullBackupOperation"] + vault_base_url: str, + azure_storage_blob_container_uri: Optional[_models.SASTokenParameter] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This operation is supported only by the Managed HSM service. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call. Default value is None. :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -281,102 +260,185 @@ def begin_full_backup( :return: An instance of LROPoller that returns either FullBackupOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Default value is None. + :type azure_storage_blob_container_uri: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_full_backup( + self, + vault_base_url: str, + azure_storage_blob_container_uri: Optional[Union[_models.SASTokenParameter, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.FullBackupOperation]: + """Creates a full backup using a user-provided SAS token to an Azure blob storage container. This + operation is supported only by the Managed HSM service. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a + valid Azure blob container where full backup needs to be stored. This token needs to be valid + for at least next 24 hours from the time of making this call. Is either a model type or a IO + type. Default value is None. + :type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FullBackupOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._full_backup_initial( + raw_result = self._full_backup_initial( # type: ignore vault_base_url=vault_base_url, azure_storage_blob_container_uri=azure_storage_blob_container_uri, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_backup.metadata = {'url': "/backup"} # type: ignore + begin_full_backup.metadata = {"url": "/backup"} # type: ignore @distributed_trace - def full_backup_status( - self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FullBackupOperation" + def full_backup_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.FullBackupOperation: """Returns the status of full backup operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The id returned as part of the backup request. + :param job_id: The id returned as part of the backup request. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FullBackupOperation, or the result of cls(response) + :return: FullBackupOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.FullBackupOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FullBackupOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FullBackupOperation] - request = build_full_backup_status_request( job_id=job_id, api_version=api_version, - template_url=self.full_backup_status.metadata['url'], + template_url=self.full_backup_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,90 +446,108 @@ def full_backup_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('FullBackupOperation', pipeline_response) + deserialized = self._deserialize("FullBackupOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - full_backup_status.metadata = {'url': "/backup/{jobId}/pending"} # type: ignore - + full_backup_status.metadata = {"url": "/backup/{jobId}/pending"} # type: ignore def _full_restore_operation_initial( self, - vault_base_url, # type: str - restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> _models.RestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'RestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "RestoreOperationParameters") + else: + _json = None - request = build_full_restore_operation_request_initial( + request = build_full_restore_operation_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self._full_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._full_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _full_restore_operation_initial.metadata = {'url': "/restore"} # type: ignore - + _full_restore_operation_initial.metadata = {"url": "/restore"} # type: ignore - @distributed_trace + @overload def begin_full_restore_operation( self, - vault_base_url, # type: str - restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestoreOperation"] + vault_base_url: str, + restore_blob_details: Optional[_models.RestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: """Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -479,102 +559,182 @@ def begin_full_restore_operation( :return: An instance of LROPoller that returns either RestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_full_restore_operation( + self, + vault_base_url: str, + restore_blob_details: Optional[Union[_models.RestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.RestoreOperation]: + """Restores all key materials using the SAS token pointing to a previously stored Azure Blob + storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RestoreOperation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._full_restore_operation_initial( + raw_result = self._full_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('RestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_full_restore_operation.metadata = {'url': "/restore"} # type: ignore + begin_full_restore_operation.metadata = {"url": "/restore"} # type: ignore @distributed_trace - def restore_status( - self, - vault_base_url, # type: str - job_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreOperation" + def restore_status(self, vault_base_url: str, job_id: str, **kwargs: Any) -> _models.RestoreOperation: """Returns the status of restore operation. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param job_id: The Job Id returned part of the restore operation. + :param job_id: The Job Id returned part of the restore operation. Required. :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RestoreOperation, or the result of cls(response) + :return: RestoreOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RestoreOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RestoreOperation] - request = build_restore_status_request( job_id=job_id, api_version=api_version, - template_url=self.restore_status.metadata['url'], + template_url=self.restore_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,95 +742,186 @@ def restore_status( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RestoreOperation', pipeline_response) + deserialized = self._deserialize("RestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_status.metadata = {'url': "/restore/{jobId}/pending"} # type: ignore - + restore_status.metadata = {"url": "/restore/{jobId}/pending"} # type: ignore def _selective_key_restore_operation_initial( self, - vault_base_url, # type: str - key_name, # type: str - restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SelectiveKeyRestoreOperation" - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> _models.SelectiveKeyRestoreOperation: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if restore_blob_details is not None: - _json = self._serialize.body(restore_blob_details, 'SelectiveKeyRestoreOperationParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(restore_blob_details, (IO, bytes)): + _content = restore_blob_details else: - _json = None + if restore_blob_details is not None: + _json = self._serialize.body(restore_blob_details, "SelectiveKeyRestoreOperationParameters") + else: + _json = None - request = build_selective_key_restore_operation_request_initial( + request = build_selective_key_restore_operation_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._selective_key_restore_operation_initial.metadata['url'], + content=_content, + template_url=self._selective_key_restore_operation_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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 HttpResponseError(response=response) + error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _selective_key_restore_operation_initial.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + _selective_key_restore_operation_initial.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore + + @overload + def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[_models.SelectiveKeyRestoreOperationParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Default value is None. + :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace + @overload def begin_selective_key_restore_operation( self, - vault_base_url, # type: str - key_name, # type: str - restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SelectiveKeyRestoreOperation"] + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: """Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to be restored from the user supplied backup. + :param key_name: The name of the key to be restored from the user supplied backup. Required. :type key_name: str :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. Default value is None. + :type restore_blob_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_selective_key_restore_operation( + self, + vault_base_url: str, + key_name: str, + restore_blob_details: Optional[Union[_models.SelectiveKeyRestoreOperationParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SelectiveKeyRestoreOperation]: + """Restores all key versions of a given key using user supplied SAS token pointing to a previously + stored Azure Blob storage backup folder. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to be restored from the user supplied backup. Required. + :type key_name: str + :param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous + successful full backup was stored. Is either a model type or a IO type. Default value is None. :type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for @@ -682,55 +933,69 @@ def begin_selective_key_restore_operation( :return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SelectiveKeyRestoreOperation"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SelectiveKeyRestoreOperation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._selective_key_restore_operation_initial( + raw_result = self._selective_key_restore_operation_initial( # type: ignore vault_base_url=vault_base_url, key_name=key_name, restore_blob_details=restore_blob_details, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('SelectiveKeyRestoreOperation', pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SelectiveKeyRestoreOperation", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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), } - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, + LROBasePolling( + lro_delay, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=path_format_arguments, + **kwargs + ), + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_selective_key_restore_operation.metadata = {'url': "/keys/{keyName}/restore"} # type: ignore + begin_selective_key_restore_operation.metadata = {"url": "/keys/{keyName}/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_patch.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_assignments_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_assignments_operations.py index f27ad55e1691..ec3e315b7913 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_assignments_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_assignments_operations.py @@ -6,175 +6,140 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_delete_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - accept = "application/json" +def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_scope_request( - scope, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - filter = kwargs.pop('filter', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -# fmt: on -class RoleAssignmentsOperations(object): + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoleAssignmentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -187,61 +152,61 @@ class RoleAssignmentsOperations(object): models = _models def __init__(self, *args, **kwargs): - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( - self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any + ) -> _models.RoleAssignment: """Deletes a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to delete. + :param scope: The scope of the role assignment to delete. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to delete. + :param role_assignment_name: The name of the role assignment to delete. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_delete_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,52 +214,128 @@ def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore + @overload + def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: _models.RoleAssignmentCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleAssignment: + """Creates a role assignment. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role assignment to create. Required. + :type scope: str + :param role_assignment_name: The name of the role assignment to create. It can be any valid + GUID. Required. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleAssignment or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create( self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - parameters, # type: "_models.RoleAssignmentCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + vault_base_url: str, + scope: str, + role_assignment_name: str, + parameters: Union[_models.RoleAssignmentCreateParameters, IO], + **kwargs: Any + ) -> _models.RoleAssignment: """Creates a role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment to create. + :param scope: The scope of the role assignment to create. Required. :type scope: str :param role_assignment_name: The name of the role assignment to create. It can be any valid - GUID. + GUID. Required. :type role_assignment_name: str - :param parameters: Parameters for the role assignment. - :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters + :param parameters: Parameters for the role assignment. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleAssignmentCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") request = build_create_request( scope=scope, @@ -302,19 +343,21 @@ def create( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create.metadata['url'], + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -322,64 +365,62 @@ def create( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace - def get( - self, - vault_base_url, # type: str - scope, # type: str - role_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleAssignment" + def get(self, vault_base_url: str, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment: """Get the specified role assignment. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignment. + :param scope: The scope of the role assignment. Required. :type scope: str - :param role_assignment_name: The name of the role assignment to get. + :param role_assignment_name: The name of the role assignment to get. Required. :type role_assignment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment, or the result of cls(response) + :return: RoleAssignment or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleAssignment - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignment"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignment] - request = build_get_request( scope=scope, role_assignment_name=role_assignment_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -387,80 +428,76 @@ def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleAssignment', pipeline_response) + deserialized = self._deserialize("RoleAssignment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} # type: ignore @distributed_trace def list_for_scope( - self, - vault_base_url, # type: str - scope, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleAssignmentListResult"] + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.RoleAssignment"]: """Gets role assignments for a scope. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role assignments. + :param scope: The scope of the role assignments. Required. :type scope: str :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.RoleAssignmentListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleAssignment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.RoleAssignment] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleAssignmentListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleAssignmentListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_for_scope_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list_for_scope.metadata['url'], + api_version=api_version, + template_url=self.list_for_scope.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -474,10 +511,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -488,8 +523,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_for_scope.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore + list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_definitions_operations.py b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_definitions_operations.py index 5068fa1d50e4..0cc824e672ee 100644 --- a/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_definitions_operations.py +++ b/sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_3/operations/_role_definitions_operations.py @@ -6,175 +6,140 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_delete_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - accept = "application/json" +def build_delete_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(scope: str, role_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, 'str'), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "roleDefinitionName": _SERIALIZER.url("role_definition_name", role_definition_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - scope, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - filter = kwargs.pop('filter', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions") path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -# fmt: on -class RoleDefinitionsOperations(object): + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoleDefinitionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -187,61 +152,62 @@ class RoleDefinitionsOperations(object): models = _models def __init__(self, *args, **kwargs): - args = list(args) - self._client = args.pop(0) if args else kwargs.pop("client") - self._config = args.pop(0) if args else kwargs.pop("config") - self._serialize = args.pop(0) if args else kwargs.pop("serializer") - self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") - + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( - self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any + ) -> _models.RoleDefinition: """Deletes a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to delete. Managed HSM only supports '/'. + Required. :type scope: str - :param role_definition_name: The name (GUID) of the role definition to delete. + :param role_definition_name: The name (GUID) of the role definition to delete. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_delete_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,53 +215,131 @@ def delete( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore + @overload + def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: _models.RoleDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RoleDefinition: + """Creates or updates a custom role definition. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param scope: The scope of the role definition to create or update. Managed HSM only supports + '/'. Required. + :type scope: str + :param role_definition_name: The name of the role definition to create or update. It can be any + valid GUID. Required. + :type role_definition_name: str + :param parameters: Parameters for the role definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleDefinition or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RoleDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_or_update( self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - parameters, # type: "_models.RoleDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + vault_base_url: str, + scope: str, + role_definition_name: str, + parameters: Union[_models.RoleDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _models.RoleDefinition: """Creates or updates a custom role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param scope: The scope of the role definition to create or update. Managed HSM only supports - '/'. + '/'. Required. :type scope: str :param role_definition_name: The name of the role definition to create or update. It can be any - valid GUID. + valid GUID. Required. :type role_definition_name: str - :param parameters: Parameters for the role definition. - :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters + :param parameters: Parameters for the role definition. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.RoleDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RoleDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RoleDefinitionCreateParameters") request = build_create_or_update_request( scope=scope, @@ -303,19 +347,21 @@ def create_or_update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [201]: @@ -323,64 +369,62 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace - def get( - self, - vault_base_url, # type: str - scope, # type: str - role_definition_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RoleDefinition" + def get(self, vault_base_url: str, scope: str, role_definition_name: str, **kwargs: Any) -> _models.RoleDefinition: """Get the specified role definition. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition to get. Managed HSM only supports '/'. + :param scope: The scope of the role definition to get. Managed HSM only supports '/'. Required. :type scope: str - :param role_definition_name: The name of the role definition to get. + :param role_definition_name: The name of the role definition to get. Required. :type role_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition, or the result of cls(response) + :return: RoleDefinition or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RoleDefinition - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinition"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinition] - request = build_get_request( scope=scope, role_definition_name=role_definition_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -388,79 +432,75 @@ def get( error = self._deserialize.failsafe_deserialize(_models.KeyVaultError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('RoleDefinition', pipeline_response) + deserialized = self._deserialize("RoleDefinition", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore - + get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}"} # type: ignore @distributed_trace def list( - self, - vault_base_url, # type: str - scope, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleDefinitionListResult"] + self, vault_base_url: str, scope: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.RoleDefinition"]: """Get all role definitions that are applicable at scope and above. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param scope: The scope of the role definition. + :param scope: The scope of the role definition. Required. :type scope: str :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinitionListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.RoleDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RoleDefinition or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.RoleDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RoleDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( scope=scope, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_list_request( - scope=scope, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -474,10 +514,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -488,8 +526,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-administration/setup.py b/sdk/keyvault/azure-keyvault-administration/setup.py index dca01d2dd367..63c06d2e0a8a 100644 --- a/sdk/keyvault/azure-keyvault-administration/setup.py +++ b/sdk/keyvault/azure-keyvault-administration/setup.py @@ -66,5 +66,5 @@ ] ), python_requires=">=3.6", - install_requires=["azure-common~=1.1", "azure-core<2.0.0,>=1.24.0", "msrest>=0.7.1", "six>=1.11.0"], + install_requires=["azure-common~=1.1", "azure-core<2.0.0,>=1.24.0", "six>=1.11.0"], ) diff --git a/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md b/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md index 559e54870d7e..e4a5da7a3d77 100644 --- a/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md @@ -9,6 +9,8 @@ ### Bugs Fixed ### Other Changes +- Updated minimum `azure-core` version to 1.24.0 +- Dropped `msrest` requirement ## 4.6.0 (2022-09-19) 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 a6c1f9b7a792..f81543eeed02 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 @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION 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 index 4a4fcbedaa26..8d4e90f2c212 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py @@ -8,31 +8,40 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential """ def __init__( self, + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -45,8 +54,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 index eb887a77b898..8e0244f42815 100644 --- 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 @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from azure.core.credentials import TokenCredential class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -41,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -58,6 +60,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "TokenCredential", api_version=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any @@ -66,8 +69,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile 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 index bf735814d772..1327def50d11 100644 --- 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 @@ -8,39 +8,36 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import TYPE_CHECKING +from ._serialization import Serializer, Deserializer +from typing import Any, IO, Iterable, Optional, Union -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable, Optional +from azure.core.paging import ItemPaged - from azure.core.paging import ItemPaged +from . import models as _models class KeyVaultClientOperationsMixin(object): def backup_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -63,11 +60,10 @@ def backup_certificate( def backup_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -82,14 +78,14 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -108,24 +104,23 @@ def backup_key( def backup_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -144,24 +139,23 @@ def backup_secret( def backup_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -178,27 +172,30 @@ def backup_storage_account( def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -223,29 +220,32 @@ def create_certificate( def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -264,13 +264,12 @@ def create_key( def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -280,18 +279,22 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -310,25 +313,24 @@ def decrypt( def delete_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -353,21 +355,20 @@ def delete_certificate( def delete_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -392,24 +393,23 @@ def delete_certificate_contacts( def delete_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -434,25 +434,24 @@ def delete_certificate_issuer( def delete_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -477,11 +476,10 @@ def delete_certificate_operation( def delete_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -489,14 +487,14 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -515,25 +513,24 @@ def delete_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -552,24 +549,23 @@ def delete_sas_definition( def delete_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -588,21 +584,20 @@ def delete_secret( def delete_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -621,13 +616,12 @@ def delete_storage_account( def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -639,18 +633,22 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -669,27 +667,26 @@ def encrypt( def get_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -714,21 +711,20 @@ def get_certificate( def get_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -753,25 +749,24 @@ def get_certificate_contacts( def get_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -796,28 +791,26 @@ def get_certificate_issuer( def get_certificate_issuers( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -842,24 +835,23 @@ def get_certificate_issuers( def get_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -884,24 +876,23 @@ def get_certificate_operation( def get_certificate_policy( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -926,29 +917,27 @@ def get_certificate_policy( 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"] + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -973,26 +962,24 @@ def get_certificate_versions( def get_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -1017,25 +1004,24 @@ def get_certificates( def get_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -1060,11 +1046,10 @@ def get_deleted_certificate( def get_deleted_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1072,17 +1057,16 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -1107,25 +1091,24 @@ def get_deleted_certificates( def get_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1144,11 +1127,10 @@ def get_deleted_key( def get_deleted_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -1157,16 +1139,15 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1185,27 +1166,26 @@ def get_deleted_keys( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1222,30 +1202,28 @@ def get_deleted_sas_definition( def get_deleted_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1262,24 +1240,23 @@ def get_deleted_sas_definitions( def get_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1298,27 +1275,24 @@ def get_deleted_secret( def get_deleted_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1337,24 +1311,23 @@ def get_deleted_secrets( def get_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1371,26 +1344,25 @@ def get_deleted_storage_account( def get_deleted_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1407,27 +1379,27 @@ def get_deleted_storage_accounts( def get_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1446,28 +1418,27 @@ def get_key( def get_key_versions( self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1486,11 +1457,10 @@ def get_key_versions( def get_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1498,15 +1468,15 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1525,25 +1495,24 @@ def get_keys( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1562,28 +1531,25 @@ def get_sas_definition( def get_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1602,27 +1568,26 @@ def get_sas_definitions( def get_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1641,28 +1606,27 @@ def get_secret( def get_secret_versions( self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1681,26 +1645,25 @@ def get_secret_versions( def get_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1719,22 +1682,21 @@ def get_secrets( def get_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1753,23 +1715,22 @@ def get_storage_account( def get_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1788,12 +1749,11 @@ def get_storage_accounts( def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1801,16 +1761,20 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1835,12 +1799,11 @@ def import_certificate( def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyImportParameters, IO], + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1848,16 +1811,20 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1876,28 +1843,31 @@ def import_key( def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1922,25 +1892,24 @@ def merge_certificate( def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1965,25 +1934,24 @@ def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements def purge_deleted_key( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -2002,25 +1970,24 @@ def purge_deleted_key( # pylint: disable=inconsistent-return-statements def purge_deleted_secret( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -2039,25 +2006,24 @@ def purge_deleted_secret( # pylint: disable=inconsistent-return-statements def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -2074,11 +2040,10 @@ def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statem def recover_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2086,14 +2051,14 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2118,11 +2083,10 @@ def recover_deleted_certificate( def recover_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. @@ -2130,14 +2094,14 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2156,28 +2120,27 @@ def recover_deleted_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2194,24 +2157,23 @@ def recover_deleted_sas_definition( def recover_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2230,25 +2192,24 @@ def recover_deleted_secret( def recover_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2265,25 +2226,28 @@ def recover_deleted_storage_account( def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2302,24 +2266,27 @@ def regenerate_storage_account_key( def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: Union[_models.CertificateRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2342,11 +2309,10 @@ def restore_certificate( def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: Union[_models.KeyRestoreParameters, IO], + **kwargs: Any + ) -> _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, @@ -2360,14 +2326,18 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2386,24 +2356,27 @@ def restore_key( def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: Union[_models.SecretRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2422,24 +2395,27 @@ def restore_secret( def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: Union[_models.StorageRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2456,24 +2432,27 @@ def restore_storage_account( def set_certificate_contacts( self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + contacts: Union[_models.Contacts, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2498,27 +2477,30 @@ def set_certificate_contacts( def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2543,28 +2525,31 @@ def set_certificate_issuer( def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2583,28 +2568,31 @@ def set_sas_definition( def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: Union[_models.SecretSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2623,24 +2611,27 @@ def set_secret( def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2659,31 +2650,34 @@ def set_storage_account( def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2702,13 +2696,12 @@ def sign( def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -2716,18 +2709,22 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2746,31 +2743,34 @@ def unwrap_key( def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2795,27 +2795,30 @@ def update_certificate( def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2840,28 +2843,31 @@ def update_certificate_issuer( def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2886,27 +2892,30 @@ def update_certificate_operation( 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -2931,13 +2940,12 @@ def update_certificate_policy( def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2945,18 +2953,22 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -2975,28 +2987,31 @@ def update_key( def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -3015,31 +3030,34 @@ def update_sas_definition( def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -3058,25 +3076,28 @@ def update_secret( def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -3095,13 +3116,12 @@ def update_storage_account( def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3110,18 +3130,22 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -3140,13 +3164,12 @@ def verify( def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3156,18 +3179,22 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_serialization.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_serialization.py new file mode 100644 index 000000000000..240df16c57f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, 'read'): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding='utf-8-sig') + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if 'content-type' in headers: + content_type = headers['content-type'].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds()/3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + +try: + from datetime import timezone + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0 + } + + def __init__(self, classes=None): + self.serialize_type = { + 'iso-8601': Serializer.serialize_iso, + 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, + 'duration': Serializer.serialize_duration, + 'date': Serializer.serialize_date, + 'time': Serializer.serialize_time, + 'decimal': Serializer.serialize_decimal, + 'long': Serializer.serialize_long, + 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, + 'object': self.serialize_object, + '[]': self.serialize_iter, + '{}': self.serialize_dict + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data( + target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data( + target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == '': + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) + + + if is_xml_model_serialization: + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + xml_prefix = xml_desc.get('prefix', None) + xml_ns = xml_desc.get('ns', None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if 'name' not in getattr(orig_attr, '_xml_map', {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node( + xml_name, + xml_prefix, + xml_ns + ) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format( + attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip('[]{}') + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback( + SerializationError, "Unable to build a model: "+str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [ + self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" + for d + in data + ] + if not kwargs.get('skip_quote', False): + data = [ + quote(str(d), safe='') + for d + in data + ] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ['[str]']: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type]( + data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback( + SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == 'str': + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ['' if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if 'xml' in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get('xml', {}) + xml_name = xml_desc.get('name') + if not xml_name: + xml_name = serialization_ctxt['key'] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node( + node_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data( + value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if 'xml' in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt['xml'] + xml_name = xml_desc['name'] + + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object( + value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object( + obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode('ascii') + return encoded.strip('=').replace('+', '-').replace('/', '_') + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], utc.tm_mday, + Serializer.months[utc.tm_mon], utc.tm_year, + utc.tm_hour, utc.tm_min, utc.tm_sec) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + if microseconds: + microseconds = '.'+microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + microseconds + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + return working_data.get(key) + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + + # Look for a children + is_iter_type = attr_desc['type'].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + )) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + + valid_date = re.compile( + r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' + r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + + def __init__(self, classes=None): + self.deserialize_type = { + 'iso-8601': Deserializer.deserialize_iso, + 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, + 'duration': Deserializer.deserialize_duration, + 'date': Deserializer.deserialize_date, + 'time': Deserializer.deserialize_time, + 'decimal': Deserializer.deserialize_decimal, + 'long': Deserializer.deserialize_long, + 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, + 'object': self.deserialize_object, + '[]': self.deserialize_iter, + '{}': self.deserialize_dict + } + self.deserialize_expected_types = { + 'duration': (isodate.Duration, datetime.timedelta), + 'iso-8601': (datetime.datetime) + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [ + rest_key_extractor, + xml_key_extractor + ] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, '_validation', {}).items() + if config.get('constant')] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig['type'] + internal_data_type = local_type.strip('[]{}') + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr( + data, + attr, + self._deserialize(local_type, value) + ) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == '': + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip('[]{}') + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ("Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning( + msg, + found_value, + key_extractor, + attr + ) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc['type']) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) + for desc in attribute_map.values() if desc['key'] != ''} + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + #Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text(), + raw_data.headers + ) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, '_content_consumed'): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text, + raw_data.headers + ) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, '_subtype_map', {}) + try: + readonly = [k for k, v in response._validation.items() + if v.get('readonly')] + const = [k for k, v in response._validation.items() + if v.get('constant')] + kwargs = {k: v for k, v in attrs.items() + if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format( + kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( + iter_type, + type(attr) + )) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, 'str') + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object( + value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object( + obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return '' + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == 'bool': + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ['true', '1']: + return True + elif attr.lower() in ['false', '0']: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == 'str': + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], + tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split('.') + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration.py index 618024f0b97c..08735390ee1c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration.py @@ -8,26 +8,39 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ def __init__( self, + credential: "AsyncTokenCredential", **kwargs # type: Any ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -39,8 +52,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client.py index 8ac51bfe8ae6..d032063470e3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client.py @@ -9,17 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -37,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -54,6 +60,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "AsyncTokenCredential", api_version: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any @@ -62,8 +69,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin.py index b51b5d66577c..e7af9c548a57 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin.py @@ -8,11 +8,13 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Optional +from .._serialization import Serializer, Deserializer +from typing import Any, AsyncIterable, IO, Optional, Union from azure.core.async_paging import AsyncItemPaged +from .. import models as _models + class KeyVaultClientOperationsMixin(object): @@ -21,21 +23,21 @@ async def backup_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.BackupCertificateResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -61,7 +63,7 @@ async def backup_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.BackupKeyResult": + ) -> _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 @@ -76,14 +78,14 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -105,20 +107,20 @@ async def backup_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.BackupSecretResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -140,20 +142,20 @@ async def backup_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.BackupStorageResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -172,24 +174,28 @@ async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -216,26 +222,30 @@ async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -257,9 +267,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -269,18 +279,22 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -302,21 +316,21 @@ async def delete_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -343,18 +357,18 @@ async def delete_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -382,20 +396,20 @@ async def delete_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -423,21 +437,21 @@ async def delete_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -465,7 +479,7 @@ async def delete_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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 @@ -473,14 +487,14 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -503,20 +517,20 @@ async def delete_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -538,20 +552,20 @@ async def delete_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -573,17 +587,17 @@ async def delete_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -605,9 +619,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -619,18 +633,22 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -653,22 +671,22 @@ async def get_certificate( certificate_name: str, certificate_version: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -695,18 +713,18 @@ async def get_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -734,21 +752,21 @@ async def get_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -776,24 +794,24 @@ def get_certificate_issuers( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -821,20 +839,20 @@ async def get_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -862,20 +880,20 @@ async def get_certificate_policy( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -904,25 +922,24 @@ def get_certificate_versions( certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -950,23 +967,22 @@ def get_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -994,21 +1010,21 @@ async def get_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -1036,7 +1052,7 @@ def get_deleted_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1044,17 +1060,17 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -1082,21 +1098,21 @@ async def get_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1118,7 +1134,7 @@ def get_deleted_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1127,17 +1143,16 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1160,22 +1175,22 @@ async def get_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1196,25 +1211,25 @@ def get_deleted_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1234,20 +1249,20 @@ async def get_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1269,23 +1284,22 @@ def get_deleted_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1307,20 +1321,20 @@ async def get_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.DeletedStorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1340,23 +1354,23 @@ def get_deleted_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1377,22 +1391,23 @@ async def get_key( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1415,24 +1430,23 @@ def get_key_versions( key_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1454,7 +1468,7 @@ def get_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1462,16 +1476,15 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1494,20 +1507,20 @@ async def get_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1530,23 +1543,22 @@ def get_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1569,22 +1581,22 @@ async def get_secret( secret_name: str, secret_version: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1607,24 +1619,23 @@ def get_secret_versions( secret_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1646,23 +1657,22 @@ def get_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1684,18 +1694,18 @@ async def get_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1717,20 +1727,20 @@ def get_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1751,9 +1761,9 @@ async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1761,16 +1771,20 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1797,9 +1811,9 @@ async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1807,16 +1821,20 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1837,25 +1855,29 @@ async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1890,14 +1912,14 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1932,14 +1954,14 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -1968,14 +1990,14 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -2004,14 +2026,14 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -2031,7 +2053,7 @@ async def recover_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2039,14 +2061,14 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2074,7 +2096,7 @@ async def recover_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2082,14 +2104,14 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2112,23 +2134,23 @@ async def recover_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2148,20 +2170,20 @@ async def recover_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2183,21 +2205,21 @@ async def recover_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2216,22 +2238,26 @@ async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2251,22 +2277,26 @@ async def regenerate_storage_account_key( async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2290,9 +2320,9 @@ async def restore_certificate( async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -2306,14 +2336,18 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2333,22 +2367,26 @@ async def restore_key( async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2368,22 +2406,26 @@ async def restore_secret( async def restore_storage_account( self, vault_base_url: str, - parameters: "_models.StorageRestoreParameters", + parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2401,22 +2443,26 @@ async def restore_storage_account( async def set_certificate_contacts( self, vault_base_url: str, - contacts: "_models.Contacts", + contacts: Union[_models.Contacts, IO], **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2443,24 +2489,28 @@ async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: Union[_models.CertificateIssuerSetParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2488,24 +2538,28 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2526,25 +2580,29 @@ async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2565,21 +2623,25 @@ async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2601,27 +2663,31 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2643,9 +2709,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -2653,18 +2719,22 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2686,27 +2756,31 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2733,24 +2807,28 @@ async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2777,25 +2855,29 @@ async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2822,24 +2904,28 @@ async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -2867,9 +2953,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2877,18 +2963,22 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -2910,24 +3000,28 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -2949,27 +3043,31 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -2990,22 +3088,26 @@ async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -3027,9 +3129,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -3038,18 +3140,22 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -3071,9 +3177,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -3083,18 +3189,22 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': 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 110e223c2b43..265c1bc3d9bd 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 @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() 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 ea5a71f153da..0021ca88647e 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 @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) 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 84f121203cc4..aaa06cdeaa8e 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 @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest 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 index 406f3aaab330..9a33701dda24 100644 --- 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 @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,822 +65,889 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_vendor.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 110e223c2b43..265c1bc3d9bd 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 @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration.py index 7bf8c5316293..3130095b65ea 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client.py index 281ae11c1dac..5515751f6d64 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py index 18cd4b2e2be5..697635d957c6 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,263 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_backup_secret_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_secret_request, build_regenerate_storage_account_key_request, build_restore_key_request, build_restore_secret_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_backup_secret_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_secret_request, + build_regenerate_storage_account_key_request, + build_restore_key_request, + build_restore_secret_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +270,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +411,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -239,9 +543,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +553,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +599,167 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +773,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,54 +800,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -549,33 +864,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -590,64 +896,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -661,59 +974,214 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def encrypt( @@ -721,9 +1189,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -735,29 +1203,45 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -765,35 +1249,110 @@ async def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def decrypt( @@ -801,9 +1360,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -813,29 +1372,45 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -843,35 +1418,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -879,38 +1523,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -918,35 +1578,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -954,9 +1687,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -965,29 +1698,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -995,35 +1744,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Wraps a symmetric key using a specified key. - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1031,9 +1855,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1043,29 +1867,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1073,35 +1913,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1109,9 +2020,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1119,29 +2030,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1149,43 +2076,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1194,55 +2119,58 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1256,96 +2184,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1353,60 +2274,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1414,190 +2335,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace_async + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -1605,38 +2674,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1644,164 +2729,166 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1815,91 +2902,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1913,87 +2994,83 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + if not next_link: - else: - request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2007,95 +3084,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2103,306 +3175,376 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2416,336 +3558,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2759,371 +3960,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3131,129 +4627,144 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3267,158 +4778,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3426,38 +5080,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3465,379 +5135,539 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3845,55 +5675,59 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: - else: - request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3907,96 +5741,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4004,60 +5833,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4065,115 +5896,121 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4187,414 +6024,629 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4608,155 +6660,215 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_sas_definition( @@ -4764,35 +6876,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -4800,35 +6928,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_sas_definition( @@ -4836,35 +7027,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -4872,32 +7079,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + 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/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 5f3be613a755..e95cdc3af87a 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 @@ -6,264 +6,186 @@ # 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 BackupKeyResult - from ._models_py3 import BackupSecretResult - 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 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 DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 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 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 ._models_py3 import Action +from ._models_py3 import AdministratorDetails +from ._models_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import BackupSecretResult +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 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 DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 SubjectAlternativeNames +from ._models_py3 import Trigger +from ._models_py3 import X509CertificateProperties -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupKeyResult', - 'BackupSecretResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - 'DeletedCertificateBundle', - 'DeletedCertificateItem', - 'DeletedCertificateListResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'IssuerAttributes', - 'IssuerBundle', - 'IssuerCredentials', - 'IssuerParameters', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'LifetimeAction', - 'OrganizationDetails', - 'PendingCertificateSigningRequestResult', - 'SasDefinitionAttributes', - 'SasDefinitionBundle', - 'SasDefinitionCreateParameters', - 'SasDefinitionItem', - 'SasDefinitionListResult', - 'SasDefinitionUpdateParameters', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'StorageAccountAttributes', - 'StorageAccountCreateParameters', - 'StorageAccountItem', - 'StorageAccountRegenerteKeyParameters', - 'StorageAccountUpdateParameters', - 'StorageBundle', - 'StorageListResult', - 'SubjectAlternativeNames', - 'Trigger', - 'X509CertificateProperties', - 'ActionType', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupKeyResult", + "BackupSecretResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "DeletedCertificateBundle", + "DeletedCertificateItem", + "DeletedCertificateListResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "IssuerAttributes", + "IssuerBundle", + "IssuerCredentials", + "IssuerParameters", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyRestoreParameters", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "LifetimeAction", + "OrganizationDetails", + "PendingCertificateSigningRequestResult", + "SasDefinitionAttributes", + "SasDefinitionBundle", + "SasDefinitionCreateParameters", + "SasDefinitionItem", + "SasDefinitionListResult", + "SasDefinitionUpdateParameters", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "StorageAccountAttributes", + "StorageAccountCreateParameters", + "StorageAccountItem", + "StorageAccountRegenerteKeyParameters", + "StorageAccountUpdateParameters", + "StorageBundle", + "StorageListResult", + "SubjectAlternativeNames", + "Trigger", + "X509CertificateProperties", + "ActionType", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 5c095aa3ecb5..81cad1a34048 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 @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -37,9 +36,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: deletion. RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -50,17 +49,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. SECP256_K1 = "SECP256K1" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -69,7 +68,8 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ @@ -86,9 +86,9 @@ class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, ES512 = "ES512" ECDSA256 = "ECDSA256" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JsonWebKey key type (kty). - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JsonWebKey key type (kty).""" EC = "EC" EC_HSM = "EC-HSM" @@ -96,7 +96,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA_HSM = "RSA-HSM" OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" 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 deleted file mode 100644 index c1756054d9ee..000000000000 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models.py +++ /dev/null @@ -1,3452 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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 CertificateAttributes(Attributes): - """The certificate management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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.v2016_10_01.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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.v2016_10_01.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v2016_10_01.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v2016_10_01.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - """ - 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 CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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.v2016_10_01.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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 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.v2016_10_01.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Type of certificate to be requested from the issuer provider. - :vartype certificate_type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Type of certificate to be requested from the issuer provider. - :paramtype certificate_type: str - """ - super(IssuerParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.certificate_type = kwargs.get('certificate_type', None) - - -class JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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.v2016_10_01.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The key type. - :vartype key_type: str - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The key type. - :paramtype key_type: str - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - """ - 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) - - -class KeyRestoreParameters(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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.v2016_10_01.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v2016_10_01.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v2016_10_01.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -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. - - :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. - :vartype parameters: dict[str, str] - :ivar attributes: The SAS definition attributes. - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.parameters = None - self.attributes = None - self.tags = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _validation = { - 'parameters': {'required': True}, - } - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.parameters = kwargs['parameters'] - self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) - self.tags = kwargs.get('tags', None) - - -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. - - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :ivar parameters: Sas definition update metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Sas definition update metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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.v2016_10_01.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(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. - - :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: A set of 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 StorageAccountRegenerteKeyParameters(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 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. - - :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.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] - """ - - _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 StorageListResult(msrest.serialization.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.v2016_10_01.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 SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: - ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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/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 d6089212548c..92798f86dd32 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,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -152,24 +148,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -179,20 +171,16 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -214,24 +202,24 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and + "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -250,11 +238,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -270,55 +258,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -330,28 +318,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -360,22 +348,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :ivar base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -384,20 +372,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -405,14 +393,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :keyword base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -421,10 +409,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -432,7 +420,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -442,16 +430,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -459,12 +443,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -477,32 +461,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -513,27 +493,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -542,14 +522,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -563,19 +543,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -588,38 +568,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -629,19 +609,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -654,72 +634,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -730,7 +706,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -747,30 +723,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -780,7 +756,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -795,7 +771,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -807,40 +783,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -864,28 +835,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -904,7 +875,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -914,28 +885,28 @@ def __init__( self.attributes = attributes -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -944,16 +915,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -965,18 +936,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -986,13 +952,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1004,30 +970,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1043,12 +1004,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1060,54 +1021,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1122,7 +1083,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1136,25 +1097,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1165,7 +1126,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1173,13 +1134,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1192,27 +1153,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1221,7 +1178,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1229,21 +1186,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1252,10 +1209,10 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1271,7 +1228,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1286,26 +1243,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1315,19 +1272,19 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1336,7 +1293,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1344,21 +1301,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1367,10 +1324,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1386,7 +1343,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1401,26 +1358,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1430,19 +1387,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1455,27 +1412,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1488,7 +1441,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1499,27 +1452,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1532,10 +1485,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1558,7 +1511,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1576,32 +1529,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1615,19 +1568,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1636,7 +1589,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1646,22 +1599,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -1671,12 +1624,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -1693,7 +1646,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1710,27 +1663,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -1741,7 +1694,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -1749,13 +1702,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1768,27 +1721,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1802,30 +1751,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1839,33 +1784,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1883,24 +1823,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1913,7 +1853,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1921,7 +1861,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1931,29 +1871,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1964,17 +1898,11 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - certificate_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, certificate_type: Optional[str] = None, **kwargs): """ :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. @@ -1982,18 +1910,18 @@ def __init__( :keyword certificate_type: Type of certificate to be requested from the issuer provider. :paramtype certificate_type: str """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :ivar kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and + "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2017,8 +1945,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2027,29 +1955,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2061,7 +1989,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2069,8 +1997,8 @@ def __init__( """ :keyword kid: Key identifier. :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :keyword kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", + and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2094,15 +2022,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2138,25 +2066,25 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2175,17 +2103,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2193,40 +2121,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2234,13 +2162,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "SECP256K1". :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2249,59 +2177,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2314,27 +2242,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2346,68 +2270,58 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. @@ -2421,10 +2335,10 @@ class KeyProperties(msrest.serialization.Model): """ _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'}, + "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"}, } def __init__( @@ -2446,52 +2360,47 @@ def __init__( :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size self.reuse_key = reuse_key -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -2499,37 +2408,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -2537,21 +2440,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2561,16 +2464,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -2580,75 +2483,72 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2658,24 +2558,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -2685,16 +2581,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -2702,12 +2594,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v2016_10_01.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -2717,15 +2609,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -2734,12 +2626,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2749,24 +2641,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -2780,33 +2668,28 @@ class SasDefinitionAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -2819,33 +2702,29 @@ class SasDefinitionBundle(msrest.serialization.Model): :vartype parameters: dict[str, str] :ivar attributes: The SAS definition attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "parameters": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "parameters": {"key": "parameters", "type": "{str}"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.parameters = None @@ -2853,53 +2732,53 @@ def __init__( self.tags = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :ivar parameters: Sas definition creation metadata in the form of key-value pairs. Required. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'parameters': {'required': True}, + "parameters": {"required": True}, } _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Dict[str, str], - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :keyword parameters: Sas definition creation metadata in the form of key-value pairs. Required. :paramtype parameters: dict[str, str] :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -2910,38 +2789,34 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None self.tags = None -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2954,48 +2829,44 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :ivar parameters: Sas definition update metadata in the form of key-value pairs. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Optional[Dict[str, str]] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3005,10 +2876,10 @@ def __init__( :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags @@ -3032,24 +2903,24 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3068,11 +2939,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3085,27 +2956,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3113,62 +2980,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3177,14 +3034,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3193,48 +3050,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3243,16 +3100,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3266,66 +3123,61 @@ class StorageAccountAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3335,27 +3187,27 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3364,7 +3216,7 @@ def __init__( self.tags = tags -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -3375,69 +3227,60 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None self.tags = None -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -3449,16 +3292,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -3467,7 +3310,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3481,10 +3324,10 @@ def __init__( :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -3492,7 +3335,7 @@ def __init__( self.tags = tags -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -3509,37 +3352,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -3549,7 +3388,7 @@ def __init__( self.tags = None -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3562,27 +3401,23 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -3594,9 +3429,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -3615,13 +3450,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -3634,20 +3469,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -3658,12 +3489,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -3679,15 +3510,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -3695,8 +3526,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -3713,7 +3544,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 44bfc9d07bb1..49b0ac3bcab0 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 @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 2f19f8e0841e..74c50773e8a5 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 @@ -6,2396 +6,1898 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" - # Construct URL + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2403,71 +1905,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2475,67 +2046,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2543,29 +2188,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2573,169 +2234,167 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2749,34 +2408,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -2784,53 +2435,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2844,34 +2499,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2886,65 +2531,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -2958,70 +2609,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3033,29 +2838,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3063,46 +2884,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3112,29 +3007,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3142,75 +3053,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3218,46 +3213,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3266,29 +3333,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3296,46 +3379,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3345,29 +3502,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3375,46 +3548,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3422,29 +3665,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3452,44 +3711,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3498,54 +3754,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3559,160 +3818,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -3720,232 +3969,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -3953,165 +4363,166 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4125,91 +4536,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4223,88 +4628,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4318,407 +4717,462 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4732,341 +5186,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5080,377 +5587,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5458,129 +6250,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5594,200 +6400,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -5795,385 +6757,539 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Updates a certificate operation. - get_certificate.metadata = {'url': "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6181,55 +7297,58 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6243,160 +7362,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6404,115 +7517,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6526,420 +7644,628 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6953,194 +8279,267 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -7148,72 +8547,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -7221,32 +8698,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + 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/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 110e223c2b43..265c1bc3d9bd 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 @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() 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 1a95df0f5541..07502e68f9a8 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 @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) 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 1ff950f493ad..278870c0c99f 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 @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest 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 index ccc1f8cc1b7d..52a7aea7ec22 100644 --- 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 @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,954 +65,1032 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "purge_deleted_storage_account" : { "sync": { - "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "restore_storage_account" : { "sync": { - "signature": "def restore_storage_account(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.StorageRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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\"\"\"" + "signature": "def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: \"_models.StorageRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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, parameters" + "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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, parameters" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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, parameters" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_vendor.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 110e223c2b43..265c1bc3d9bd 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 @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration.py index f6e89c64060a..70a7128f9849 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client.py index 6ea7e93e1c23..30630cac0343 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_key_vault_client_operations.py index d289d2e35470..89d3a02a3479 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,274 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_backup_key_request, build_backup_secret_request, build_backup_storage_account_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_sas_definition_request, build_get_deleted_sas_definitions_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_deleted_storage_account_request, build_get_deleted_storage_accounts_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_purge_deleted_storage_account_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_sas_definition_request, build_recover_deleted_secret_request, build_recover_deleted_storage_account_request, build_regenerate_storage_account_key_request, build_restore_certificate_request, build_restore_key_request, build_restore_secret_request, build_restore_storage_account_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_backup_key_request, + build_backup_secret_request, + build_backup_storage_account_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_sas_definition_request, + build_get_deleted_sas_definitions_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_deleted_storage_account_request, + build_get_deleted_storage_accounts_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_purge_deleted_storage_account_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_sas_definition_request, + build_recover_deleted_secret_request, + build_recover_deleted_storage_account_request, + build_regenerate_storage_account_key_request, + build_restore_certificate_request, + build_restore_key_request, + build_restore_secret_request, + build_restore_storage_account_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +281,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +422,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_key( @@ -239,9 +554,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +564,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +610,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +785,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,53 +812,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -548,33 +876,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -589,64 +908,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -660,69 +986,148 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore - + restore_key.metadata = {"url": "/keys/restore"} # type: ignore - @distributed_trace_async + @overload async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -734,107 +1139,290 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. + :param parameters: The parameters for the encryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyOperationsParameters') - - request = build_encrypt_request( - key_name=key_name, - key_version=key_version, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.encrypt.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('KeyOperationResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore - - @distributed_trace_async - async def decrypt( + @overload + async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": - """Decrypts a single block of encrypted data. + ) -> _models.KeyOperationResult: + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. - 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 + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") + + request = build_encrypt_request( + key_name=key_name, + key_version=key_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. + :param parameters: The parameters for the decryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -842,35 +1430,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def sign( @@ -878,38 +1535,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -917,35 +1590,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def verify( @@ -953,9 +1699,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -964,29 +1710,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -994,35 +1756,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def wrap_key( @@ -1030,9 +1867,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1042,29 +1879,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1072,35 +1925,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def unwrap_key( @@ -1108,9 +2032,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1118,29 +2042,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1148,43 +2088,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1193,55 +2131,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1255,96 +2195,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1352,60 +2285,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1413,190 +2346,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_secret( - self, - vault_base_url: str, - secret_name: str, - parameters: "_models.SecretSetParameters", - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_secret( @@ -1604,38 +2685,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1643,164 +2740,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1814,90 +2914,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1911,87 +3006,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2005,95 +3095,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2101,244 +3186,314 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( @@ -2347,13 +3502,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2362,51 +3517,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2420,336 +3576,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2763,371 +3978,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3135,129 +4645,143 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3271,158 +4795,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3430,38 +5097,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3469,501 +5152,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -3972,7 +5883,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3980,7 +5891,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -3989,51 +5900,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4047,96 +5961,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4144,60 +6053,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4205,114 +6116,120 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4326,87 +6243,84 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4420,95 +6334,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace_async async def get_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any + self, vault_base_url: str, storage_account_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified storage account. @@ -4516,634 +6425,924 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def recover_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace_async async def backup_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.BackupStorageResult": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore + + @overload + async def restore_storage_account( + self, + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + @overload + async def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def restore_storage_account( - self, - vault_base_url: str, - parameters: "_models.StorageRestoreParameters", - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5157,92 +7356,87 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5256,290 +7450,352 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def get_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def recover_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_sas_definition( @@ -5547,35 +7803,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -5583,35 +7855,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_sas_definition( @@ -5619,35 +7954,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -5655,32 +8006,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + 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/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 433900a34cfd..6726525a0e5d 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 @@ -6,296 +6,208 @@ # 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 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 - 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 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 # 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 ._models_py3 import Action +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 +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 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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, - SasTokenType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._key_vault_client_enums import SasTokenType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupCertificateResult', - 'BackupKeyResult', - 'BackupSecretResult', - 'BackupStorageResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateRestoreParameters', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - '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', - 'KeyVerifyParameters', - 'KeyVerifyResult', - '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', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', - 'SasTokenType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupCertificateResult", + "BackupKeyResult", + "BackupSecretResult", + "BackupStorageResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateRestoreParameters", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "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", + "KeyVerifyParameters", + "KeyVerifyResult", + "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", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", + "SasTokenType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 fc28dcf37707..4904e43a94fb 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 @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,9 +60,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -74,17 +73,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -93,38 +92,40 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -133,14 +134,16 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is not exportable from the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is not exportable from the HSM. RSA_HSM = "RSA-HSM" - #: Not supported in this version. Octet sequence (used to represent symmetric keys). + #: Not supported in this version. Octet sequence (used to represent symmetric keys) OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" @@ -152,9 +155,9 @@ class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCIPHER_ONLY = "encipherOnly" DECIPHER_ONLY = "decipherOnly" -class SasTokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of SAS token the SAS definition will create. - """ + +class SasTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 deleted file mode 100644 index a8b606c71a97..000000000000 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models.py +++ /dev/null @@ -1,3975 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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(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. - - :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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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_0.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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_0.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_0.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_0.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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_0.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _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}'}, - } - - 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 - - -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. - - 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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _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}, - } - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -class DeletedSasDefinitionItem(SasDefinitionItem): - """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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_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'}, - '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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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_0.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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_0.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.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 - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - 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(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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_0.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_0.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_0.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_0.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_0.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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. - :vartype template_uri: str - :ivar sas_type: Required. 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: Required. The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - 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(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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :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_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: The validity period of SAS tokens created according to the SAS - definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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_0.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.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_0.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(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. - :vartype storage_bundle_backup: bytes - """ - - _validation = { - 'storage_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. - :paramtype storage_bundle_backup: bytes - """ - super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = kwargs['storage_bundle_backup'] - - -class SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models_py3.py index ff95bb20a6a6..1d042e3ec757 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,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,24 +148,20 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -179,24 +171,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -206,24 +194,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupStorageResult(msrest.serialization.Model): +class BackupStorageResult(_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. @@ -233,20 +217,16 @@ class BackupStorageResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupStorageResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -268,25 +248,25 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -305,11 +285,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -325,55 +305,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -385,28 +365,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -415,22 +395,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. + :ivar base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need to + contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -439,20 +419,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -460,14 +440,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. + :keyword base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need + to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -476,10 +456,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -487,7 +467,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -497,16 +477,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -514,12 +490,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -532,32 +508,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -568,27 +540,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -597,14 +569,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -618,19 +590,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -643,38 +615,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -684,19 +656,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -709,72 +681,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -785,7 +753,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -802,30 +770,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -835,7 +803,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -850,7 +818,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -862,40 +830,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -918,28 +881,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -957,7 +920,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -967,61 +930,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1030,16 +988,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -1051,18 +1009,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -1072,13 +1025,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1090,30 +1043,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1129,12 +1077,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1146,54 +1094,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1208,7 +1156,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1222,25 +1170,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1251,7 +1199,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1259,13 +1207,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1278,27 +1226,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1307,7 +1251,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1315,21 +1259,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1338,10 +1282,10 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1357,7 +1301,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1372,26 +1316,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1401,19 +1345,19 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1422,7 +1366,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1430,21 +1374,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1453,10 +1397,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1472,7 +1416,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1487,26 +1431,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1516,19 +1460,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1541,27 +1485,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -1573,45 +1513,41 @@ class SasDefinitionBundle(msrest.serialization.Model): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _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}, + "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}'}, + "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}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.template_uri = None @@ -1633,15 +1569,15 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1653,48 +1589,43 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): """ _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}, + "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}, } _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'}, + "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"}, } - def __init__( - self, - *, - recovery_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -1705,31 +1636,27 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None @@ -1747,7 +1674,7 @@ class DeletedSasDefinitionItem(SasDefinitionItem): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1759,42 +1686,37 @@ class DeletedSasDefinitionItem(SasDefinitionItem): """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "id": {"readonly": True}, + "secret_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'}, - '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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSasDefinitionListResult(msrest.serialization.Model): +class DeletedSasDefinitionListResult(_serialization.Model): """The deleted SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1807,27 +1729,23 @@ class DeletedSasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1840,7 +1758,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1851,27 +1769,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1884,10 +1802,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1910,7 +1828,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1928,32 +1846,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1967,19 +1885,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1988,7 +1906,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1998,22 +1916,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -2023,12 +1941,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -2045,7 +1963,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -2062,27 +1980,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -2093,7 +2011,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -2101,13 +2019,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2120,27 +2038,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -2151,31 +2065,27 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None @@ -2193,7 +2103,7 @@ class DeletedStorageAccountItem(StorageAccountItem): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2206,42 +2116,37 @@ class DeletedStorageAccountItem(StorageAccountItem): """ _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -2258,37 +2163,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -2315,7 +2216,7 @@ class DeletedStorageBundle(StorageBundle): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2328,48 +2229,43 @@ class DeletedStorageBundle(StorageBundle): """ _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}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedStorageListResult(msrest.serialization.Model): +class DeletedStorageListResult(_serialization.Model): """The deleted storage account list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2382,27 +2278,23 @@ class DeletedStorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedStorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedStorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -2416,30 +2308,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -2453,33 +2341,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -2497,24 +2380,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -2527,7 +2410,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -2535,7 +2418,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -2545,29 +2428,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -2582,9 +2459,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -2606,20 +2483,20 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2643,8 +2520,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2653,29 +2530,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2687,7 +2564,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2696,8 +2573,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2721,15 +2598,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2765,26 +2642,26 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2803,17 +2680,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2821,40 +2698,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2862,13 +2739,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2877,59 +2754,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2942,27 +2819,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2974,117 +2847,107 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -3092,45 +2955,40 @@ def __init__( self.curve = curve -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -3138,37 +2996,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -3176,21 +3028,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3200,16 +3052,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -3219,75 +3071,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3297,24 +3145,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -3324,16 +3168,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -3341,12 +3181,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_0.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -3356,15 +3196,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -3373,12 +3213,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3388,24 +3228,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3419,104 +3255,100 @@ class SasDefinitionAttributes(msrest.serialization.Model): :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", + definition, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar 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. + :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. + Required. :vartype template_uri: str - :ivar sas_type: Required. 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. Required. Known values + are: "account" and "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: Required. 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. Required. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'template_uri': {'required': True}, - 'sas_type': {'required': True}, - 'validity_period': {'required': True}, + "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}'}, + "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: Union[str, "SasTokenType"], + sas_type: Union[str, "_models.SasTokenType"], validity_period: str, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword 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. + :keyword 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. + Required. :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Required. Known values + are: "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. + :keyword validity_period: The validity period of SAS tokens created according to the SAS + definition. Required. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3524,7 +3356,7 @@ def __init__( self.tags = tags -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3537,59 +3369,55 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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: Optional[str] = None, - sas_type: Optional[Union[str, "SasTokenType"]] = None, + sas_type: Optional[Union[str, "_models.SasTokenType"]] = None, validity_period: Optional[str] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3597,18 +3425,18 @@ def __init__( :keyword 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. :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Known values are: + "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType :keyword validity_period: The validity period of SAS tokens created according to the SAS definition. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3634,25 +3462,25 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3671,11 +3499,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3688,27 +3516,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3716,62 +3540,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3780,14 +3594,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3796,48 +3610,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3846,16 +3660,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3869,76 +3683,71 @@ class StorageAccountAttributes(msrest.serialization.Model): :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", + account, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3948,26 +3757,26 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3976,38 +3785,33 @@ def __init__( self.tags = tags -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -4018,16 +3822,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -4036,7 +3840,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -4049,10 +3853,10 @@ def __init__( :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -4060,7 +3864,7 @@ def __init__( self.tags = tags -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -4073,58 +3877,49 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageRestoreParameters(msrest.serialization.Model): +class StorageRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. + :ivar storage_bundle_backup: The backup blob associated with a storage account. Required. :vartype storage_bundle_backup: bytes """ _validation = { - 'storage_bundle_backup': {'required': True}, + "storage_bundle_backup": {"required": True}, } _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, + "storage_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - storage_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, storage_bundle_backup: bytes, **kwargs): """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. + :keyword storage_bundle_backup: The backup blob associated with a storage account. Required. :paramtype storage_bundle_backup: bytes """ - super(StorageRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_bundle_backup = storage_bundle_backup -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -4136,9 +3931,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -4157,13 +3952,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -4176,20 +3971,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -4200,12 +3991,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -4221,15 +4012,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -4237,8 +4028,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -4254,7 +4045,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 44bfc9d07bb1..49b0ac3bcab0 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 @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 5901a72a5eec..27aee6d86023 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 @@ -6,2763 +6,2189 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/backup") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_storage_account_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_storage_account_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_recover_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2770,71 +2196,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2842,67 +2337,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2910,29 +2479,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2940,170 +2525,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3117,34 +2700,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -3152,53 +2727,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3212,34 +2791,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -3254,65 +2823,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -3326,70 +2901,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.KeyBundle: + """Restores a backed up key to a vault. - request = build_restore_key_request( - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.restore_key.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") + + request = build_restore_key_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3401,29 +3130,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3431,46 +3176,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3480,29 +3299,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3510,75 +3345,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3586,46 +3505,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3634,29 +3625,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3664,46 +3671,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3713,29 +3794,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3743,46 +3840,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3790,29 +3957,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3820,44 +4003,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3866,54 +4046,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3927,160 +4110,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -4088,232 +4261,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -4321,166 +4655,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4494,91 +4829,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4592,87 +4921,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4686,361 +5010,416 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -5049,50 +5428,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5106,340 +5487,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5453,377 +5888,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + deserialized = self._deserialize("IssuerBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Creates a new certificate. - delete_certificate_issuer.metadata = {'url': "/certificates/issuers/{issuer-name}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5831,129 +6551,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5967,200 +6701,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -6168,518 +7058,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6687,7 +7797,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -6696,50 +7806,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6753,160 +7866,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6914,115 +8021,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7036,87 +8148,83 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7130,740 +8238,1015 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace def get_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def recover_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace def backup_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. + :param parameters: The parameters to restore the storage account. Required. :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_storage_account( + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7877,93 +9260,86 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7977,331 +9353,404 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -8309,72 +9758,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -8382,32 +9909,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + 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/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_configuration.py index 565764479bb8..a260d72442e2 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_key_vault_client.py index ec9462870adf..ecf98c5501a0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_metadata.json index 554bdba381f6..f70bdb23e116 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_metadata.json +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,342 +65,369 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_1.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_1.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_1.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_1.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters\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\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters\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, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_vendor.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_configuration.py index 1972b53fa36f..74ea9479506a 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_key_vault_client.py index 51c1a20a5b25..278d02d53ecf 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_key_vault_client_operations.py index 7cd7177924fa..c7d2a1a88dd3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_key_vault_client_operations.py @@ -6,24 +6,64 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_create_certificate_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_import_certificate_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_recover_deleted_certificate_request, build_restore_certificate_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_create_certificate_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_import_certificate_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_recover_deleted_certificate_request, + build_restore_certificate_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace def get_certificates( self, @@ -31,13 +71,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -46,51 +86,52 @@ def get_certificates( provisioned. Default value is None. :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_1.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -104,336 +145,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_1.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_1.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_1.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -447,371 +547,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -819,129 +1214,143 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_1.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -955,158 +1364,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_certificate( @@ -1114,38 +1666,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -1153,501 +1721,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -1656,7 +2452,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1664,7 +2460,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -1673,51 +2469,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1731,96 +2530,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -1828,60 +2622,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -1889,53 +2685,58 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + 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/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/__init__.py index cf378fc39e33..d45694e5549c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/__init__.py @@ -6,138 +6,100 @@ # 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 ._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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __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', + "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", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_key_vault_client_enums.py index 42e7d6ea621b..fa4981d25bed 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,18 +60,18 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" P256 = "P-256" P384 = "P-384" P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of key pair to be used for the certificate. - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of key pair to be used for the certificate.""" EC = "EC" EC_HSM = "EC-HSM" @@ -80,7 +79,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA_HSM = "RSA-HSM" OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models.py deleted file mode 100644 index 1d61ce119f50..000000000000 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models.py +++ /dev/null @@ -1,1632 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_1.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_1.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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_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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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_1.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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_1.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_1.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_1.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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_1.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_1.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_1.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_1.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_1.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_1.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_1.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_1.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v7_1.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_1.models.Contact] - """ - 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_1.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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_1.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_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(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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype 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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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. - - :ivar exportable: Not supported in this version. Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype 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 - ): - """ - :keyword exportable: Not supported in this version. Indicates if the private key can be - exported. - :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - 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_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 LifetimeAction(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_1.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_1.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_1.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_1.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype 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 - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] - """ - 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. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - 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. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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_1/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models_py3.py index f568742837e1..0a0e939bd4c8 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_1.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_1.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,20 +148,16 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -190,27 +182,27 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -229,12 +221,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -250,55 +242,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_1.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -310,28 +302,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -340,22 +332,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. + :ivar base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need to + contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -364,20 +356,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -385,14 +377,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. + :keyword base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need + to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -401,10 +393,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -412,7 +404,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -422,16 +414,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -439,12 +427,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -457,32 +445,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials @@ -493,27 +477,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials @@ -522,14 +506,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -543,19 +527,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -568,38 +552,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -609,19 +593,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -634,72 +618,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -710,7 +690,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -727,30 +707,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -760,7 +740,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -775,7 +755,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -787,40 +767,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -843,28 +818,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -882,7 +857,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -892,61 +867,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -955,16 +925,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -976,18 +946,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -997,13 +962,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1015,30 +980,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_1.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1054,12 +1014,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_1.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1071,54 +1031,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1133,7 +1093,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1147,25 +1107,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1176,7 +1136,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1184,13 +1144,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1203,27 +1163,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1237,30 +1193,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1274,33 +1226,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1318,24 +1265,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1348,7 +1295,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1356,7 +1303,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1366,29 +1313,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1403,9 +1344,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -1427,63 +1368,63 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Not supported in this version. Indicates if the private key can be exported. :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype 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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Not supported in this version. Indicates if the private key can be exported. :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -1491,7 +1432,7 @@ def __init__( self.curve = curve -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1501,24 +1442,20 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -1528,16 +1465,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -1545,12 +1478,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_1.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -1560,15 +1493,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -1577,12 +1510,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1592,24 +1525,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -1617,24 +1546,19 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -1646,9 +1570,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -1667,13 +1591,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -1686,20 +1610,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -1710,12 +1630,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -1731,15 +1651,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -1747,8 +1667,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -1764,7 +1684,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_key_vault_client_operations.py index 32df47563bcb..aac8192ee5e8 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_key_vault_client_operations.py @@ -6,948 +6,714 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -956,50 +722,52 @@ def get_certificates( provisioned. Default value is None. :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_1.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1013,340 +781,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_1.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_1.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_1.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1360,377 +1182,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_1.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1738,129 +1845,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_1.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1874,200 +1995,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -2075,518 +2352,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_1.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -2594,7 +3091,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2603,50 +3100,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2660,160 +3160,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2821,53 +3315,58 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + 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/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_configuration.py index 457e46a57cde..77b5afbd7fa5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_key_vault_client.py index 9fb22163b5ae..6981c3324ac4 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_metadata.json index 8934d86f9e60..cec6a4c310c4 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_metadata.json +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,342 +65,369 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_2.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_2.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_2.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_2.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters\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\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters\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, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_vendor.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_configuration.py index d7d9c414df27..3f6fb536e7ae 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_key_vault_client.py index 2c20b19a9f0e..65170dfb8756 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_key_vault_client_operations.py index 942b1ca628ca..dc984c617ca5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_key_vault_client_operations.py @@ -6,24 +6,64 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_create_certificate_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_import_certificate_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_recover_deleted_certificate_request, build_restore_certificate_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_create_certificate_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_import_certificate_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_recover_deleted_certificate_request, + build_restore_certificate_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace def get_certificates( self, @@ -31,13 +71,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -46,51 +86,52 @@ def get_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -104,336 +145,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_2.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_2.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_2.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -447,371 +547,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -819,129 +1214,143 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -955,158 +1364,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_certificate( @@ -1114,38 +1666,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -1153,501 +1721,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -1656,7 +2452,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1664,7 +2460,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -1673,51 +2469,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1731,96 +2530,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -1828,60 +2622,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -1889,53 +2685,58 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + 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/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/__init__.py index cf378fc39e33..d45694e5549c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/__init__.py @@ -6,138 +6,100 @@ # 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 ._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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __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', + "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", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_key_vault_client_enums.py index 92997e4dc956..816312d940bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,18 +60,18 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" P256 = "P-256" P384 = "P-384" P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of key pair to be used for the certificate. - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of key pair to be used for the certificate.""" EC = "EC" EC_HSM = "EC-HSM" @@ -81,7 +80,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OCT = "oct" OCT_HSM = "oct-HSM" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models.py deleted file mode 100644 index 4d1baac93d32..000000000000 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models.py +++ /dev/null @@ -1,1632 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_2.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_2.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype 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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype 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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_2.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_2.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_2.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_2.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_2.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_2.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype 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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_2.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_2.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_2.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_2.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype 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 - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_2.models.Contact] - """ - 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 - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype 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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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. - - :ivar exportable: Not supported in this version. Indicates if the private key can be exported. - :vartype exportable: bool - :ivar 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". - :vartype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype 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 - ): - """ - :keyword exportable: Not supported in this version. Indicates if the private key can be - exported. - :paramtype exportable: bool - :keyword 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". - :paramtype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - """ - 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. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_2.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_2.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_2.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_2.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype 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 - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_2.models.AdministratorDetails] - """ - 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. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - 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. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_2.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_2.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_2.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_2.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models_py3.py index 74fe76758b27..ffa06959b96a 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_2.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_2.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,20 +148,16 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -190,27 +182,27 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -229,12 +221,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -250,55 +242,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -310,28 +302,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -340,22 +332,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :ivar base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -364,20 +356,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -385,14 +377,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :keyword base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -401,10 +393,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -412,7 +404,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -422,16 +414,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -439,12 +427,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -457,32 +445,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials @@ -493,27 +477,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_2.models.IssuerCredentials @@ -522,14 +506,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -543,19 +527,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -568,38 +552,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -609,19 +593,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -634,72 +618,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -710,7 +690,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -727,30 +707,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -760,7 +740,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -775,7 +755,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -787,40 +767,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -843,28 +818,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -882,7 +857,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -892,61 +867,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -955,16 +925,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -976,18 +946,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -997,13 +962,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1015,30 +980,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_2.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1054,12 +1014,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1071,54 +1031,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1133,7 +1093,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1147,25 +1107,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1176,7 +1136,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1184,13 +1144,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1203,27 +1163,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1237,30 +1193,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1274,33 +1226,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1318,24 +1265,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1348,7 +1295,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_2.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1356,7 +1303,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1366,29 +1313,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1403,9 +1344,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -1427,63 +1368,63 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Not supported in this version. Indicates if the private key can be exported. :vartype exportable: bool - :ivar 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". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype 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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Not supported in this version. Indicates if the private key can be exported. :paramtype exportable: bool - :keyword 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". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -1491,7 +1432,7 @@ def __init__( self.curve = curve -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1501,24 +1442,20 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -1528,16 +1465,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -1545,12 +1478,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_2.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -1560,15 +1493,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -1577,12 +1510,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_2.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1592,24 +1525,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -1617,24 +1546,19 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -1646,9 +1570,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -1667,13 +1591,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -1686,20 +1610,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -1710,12 +1630,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -1731,15 +1651,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -1747,8 +1667,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -1764,7 +1684,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_key_vault_client_operations.py index f680b5481870..79ed737e6dd1 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_key_vault_client_operations.py @@ -6,948 +6,714 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -956,50 +722,52 @@ def get_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1013,340 +781,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_2.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_2.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_2.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1360,377 +1182,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_2.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1738,129 +1845,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1874,200 +1995,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -2075,518 +2352,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_2.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -2594,7 +3091,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2603,50 +3100,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2660,160 +3160,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2821,53 +3315,58 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + 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/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_configuration.py index 628918574705..801ab6cd733d 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_key_vault_client.py index 0c65a11683de..5f9d522cc23a 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_metadata.json index e6b5462fb857..47c877efb53e 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_metadata.json +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,342 +65,369 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults, include_pending" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.DeletedCertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.DeletedCertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_3.models.Contacts\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_3.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_3.models.Contacts\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_3.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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_3.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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_3.models.Contacts\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, issuer_name, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, issuer_name, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, parameter, **kwargs" + } }, "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 # type: (...) -\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, issuer_name" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, **kwargs" + } }, "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 # type: (...) -\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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_3.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, issuer_name" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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_3.models.IssuerBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, issuer_name, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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. This\noperation requires the certificates/import permission. The certificate to be imported can be in\neither PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key\nas well as x509 certificates. Key Vault will only accept a key in PKCS#8 format.\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. This\noperation requires the certificates/import permission. The certificate to be imported can be in\neither PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key\nas well as x509 certificates. Key Vault will only accept a key in PKCS#8 format.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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. This\noperation requires the certificates/import permission. The certificate to be imported can be in\neither PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key\nas well as x509 certificates. Key Vault will only accept a key in PKCS#8 format.\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. This\noperation requires the certificates/import permission. The certificate to be imported can be in\neither PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key\nas well as x509 certificates. Key Vault will only accept a key in PKCS#8 format.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, maxresults" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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_3.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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_3.models.CertificatePolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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_3.models.CertificatePolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "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 # type: (...) -\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_3.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_3.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificatePolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_policy, **kwargs" }, "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: Any\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_3.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_3.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, certificate_policy" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificatePolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, certificate_version, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_version, **kwargs" }, "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: Any\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, certificate_version" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_version, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, certificate_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, certificate_operation, **kwargs" + } }, "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 # type: (...) -\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "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 # type: (...) -\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.CertificateOperation\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.BackupCertificateResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.BackupCertificateResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults, include_pending" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.DeletedCertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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_3.models.DeletedCertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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_3.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, certificate_name" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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_3.models.CertificateBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_vendor.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_configuration.py index ebf0c448e109..d86cc427064c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_key_vault_client.py index b4ee0991744f..a073964e9bdb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_vendor.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_key_vault_client_operations.py index dca1aaac451a..a63a74b99eb9 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_key_vault_client_operations.py @@ -6,24 +6,64 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_create_certificate_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_import_certificate_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_recover_deleted_certificate_request, build_restore_certificate_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_create_certificate_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_import_certificate_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_recover_deleted_certificate_request, + build_restore_certificate_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace def get_certificates( self, @@ -31,13 +71,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -46,51 +86,52 @@ def get_certificates( provisioned. Default value is None. :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_3.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -104,336 +145,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_3.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_3.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_3.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -447,371 +547,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateBundle: + """Imports a certificate into a specified key vault. + + Imports an existing valid certificate, containing a private key, into Azure Key Vault. This + operation requires the certificates/import permission. 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. Key Vault will only accept a key in PKCS#8 format. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateBundle: + """Imports a certificate into a specified key vault. + + Imports an existing valid certificate, containing a private key, into Azure Key Vault. This + operation requires the certificates/import permission. 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. Key Vault will only accept a key in PKCS#8 format. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. This @@ -819,129 +1214,143 @@ async def import_certificate( either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only accept a key in PKCS#8 format. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_3.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -955,158 +1364,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -1114,38 +1666,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -1153,501 +1721,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -1656,7 +2452,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1664,7 +2460,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -1673,51 +2469,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1731,96 +2530,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -1828,60 +2622,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -1889,53 +2685,58 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/__init__.py index cf378fc39e33..d45694e5549c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/__init__.py @@ -6,138 +6,100 @@ # 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 ._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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __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', + "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", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_key_vault_client_enums.py index 92997e4dc956..816312d940bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,18 +60,18 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" P256 = "P-256" P384 = "P-384" P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of key pair to be used for the certificate. - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of key pair to be used for the certificate.""" EC = "EC" EC_HSM = "EC-HSM" @@ -81,7 +80,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OCT = "oct" OCT_HSM = "oct-HSM" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models.py deleted file mode 100644 index bc627238900e..000000000000 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models.py +++ /dev/null @@ -1,1635 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_3.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_3.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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_3.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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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_3.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. eg. 'application/x-pem-file' or - 'application/x-pkcs12',. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. eg. 'application/x-pem-file' or - 'application/x-pkcs12',. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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_3.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_3.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_3.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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_3.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_3.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_3.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_3.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_3.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_3.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_3.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_3.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_3.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_3.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_3.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_3.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v7_3.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_3.models.Contact] - """ - 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_3.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. eg. 'application/x-pem-file' or - 'application/x-pkcs12',. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. eg. 'application/x-pem-file' or - 'application/x-pkcs12',. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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_3.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_3.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_3.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_3.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar 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". - :vartype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_3.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 - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword 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". - :paramtype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - """ - 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_3.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. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_3.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_3.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_3.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_3.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v7_3.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_3.models.AdministratorDetails] - """ - 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. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - 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. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_3.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_3.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_3.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_3.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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_3/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models_py3.py index f4de1b1db6e1..afde161dd6cd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_3.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_3.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,20 +148,16 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -190,27 +182,27 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_3.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "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'}, + "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__( @@ -229,12 +221,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -250,57 +242,57 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_3.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12',. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12',. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -312,28 +304,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -342,22 +334,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :ivar base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -366,20 +358,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -387,14 +379,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :keyword base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -403,10 +395,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -414,7 +406,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -424,16 +416,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -441,12 +429,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -459,32 +447,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials @@ -495,27 +479,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_3.models.IssuerCredentials @@ -524,14 +508,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -545,19 +529,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -570,38 +554,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -611,19 +595,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -636,72 +620,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -712,7 +692,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -729,30 +709,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -762,7 +742,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_3.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -777,7 +757,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -789,40 +769,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -845,28 +820,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -884,7 +859,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -894,61 +869,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -957,16 +927,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -978,18 +948,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -999,13 +964,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1017,30 +982,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_3.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1056,13 +1016,13 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_3.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12',. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1074,55 +1034,55 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12',. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1137,7 +1097,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1151,25 +1111,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1180,7 +1140,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1188,13 +1148,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1207,27 +1167,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1241,30 +1197,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1278,33 +1230,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1322,24 +1269,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1352,7 +1299,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_3.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1360,7 +1307,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1370,29 +1317,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1407,9 +1348,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -1431,62 +1372,62 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool - :ivar 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". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_3.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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool - :keyword 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". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -1494,7 +1435,7 @@ def __init__( self.curve = curve -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1504,24 +1445,20 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -1531,16 +1468,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -1548,12 +1481,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_3.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -1563,15 +1496,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -1580,12 +1513,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_3.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1595,24 +1528,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -1620,24 +1549,19 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -1649,9 +1573,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -1670,13 +1594,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -1689,20 +1613,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -1713,12 +1633,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -1734,15 +1654,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -1750,8 +1670,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -1767,7 +1687,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_key_vault_client_operations.py index 34c7220ada39..a7daaa3d17e8 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_key_vault_client_operations.py @@ -6,948 +6,714 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -956,50 +722,52 @@ def get_certificates( provisioned. Default value is None. :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_3.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1013,340 +781,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_3.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_3.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_3.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contacts, 'Contacts') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1360,377 +1182,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_3.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateBundle: + """Imports a certificate into a specified key vault. + + Imports an existing valid certificate, containing a private key, into Azure Key Vault. This + operation requires the certificates/import permission. 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. Key Vault will only accept a key in PKCS#8 format. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateBundle: + """Imports a certificate into a specified key vault. + + Imports an existing valid certificate, containing a private key, into Azure Key Vault. This + operation requires the certificates/import permission. 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. Key Vault will only accept a key in PKCS#8 format. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. This @@ -1738,129 +1845,143 @@ def import_certificate( either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only accept a key in PKCS#8 format. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_3.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1874,200 +1995,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_3.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -2075,518 +2352,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_3.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -2594,7 +3091,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2603,50 +3100,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2660,160 +3160,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2821,53 +3315,58 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_patch.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_3/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 index 881743a1baa6..7c2879d85d75 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated_models.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated_models.py @@ -1,78 +1,100 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # 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. # -------------------------------------------------------------------------- -# pylint: skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713) -# pylint: disable=too-many-lines -from enum import Enum, EnumMeta -import msrest.serialization -from six import with_metaclass +import datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from ._generated import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from ._generated import models as _models -class Action(msrest.serialization.Model): + +class Action(_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_1.models.ActionType + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". + :vartype action_type: str or ~azure.keyvault.v7_1.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(Action, self).__init__(**kwargs) - self.action_type = kwargs.get('action_type', None) + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): + """ + :keyword action_type: The type of the action. Known values are: "EmailContacts" and + "AutoRenew". + :paramtype action_type: str or ~azure.keyvault.v7_1.models.ActionType + """ + super().__init__(**kwargs) + self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_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 + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email_address: Email address. + :vartype email_address: str + :ivar phone: Phone number. + :vartype 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'}, + "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 = 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) + """ + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email_address: Email address. + :paramtype email_address: str + :keyword phone: Phone number. + :paramtype phone: str + """ + super().__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): +class Attributes(_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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -80,31 +102,43 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires self.created = None self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -114,18 +148,16 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -134,12 +166,12 @@ class CertificateAttributes(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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -150,39 +182,51 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "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}, + "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'}, + "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__(**kwargs) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -197,146 +241,198 @@ class CertificateBundle(msrest.serialization.Model): :vartype x509_thumbprint: bytes :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_1.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_1.models.CertificateAttributes - :param tags: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar cer: CER contents of x509 certificate. + :vartype cer: bytes + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The certificate attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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[bytes] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): - super(CertificateBundle, self).__init__(**kwargs) + """ + :keyword cer: CER contents of x509 certificate. + :paramtype cer: bytes + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The certificate attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__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) + self.cer = cer + self.content_type = content_type + self.attributes = attributes + self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar certificate_policy: The management policy for the certificate. + :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :ivar certificate_attributes: The attributes of the certificate (optional). + :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "certificate_policy": {"key": "policy", "type": "CertificatePolicy"}, + "certificate_attributes": {"key": "attributes", "type": "CertificateAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, + *, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword certificate_policy: The management policy for the certificate. + :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword certificate_attributes: The attributes of the certificate (optional). + :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.certificate_policy = certificate_policy + self.certificate_attributes = certificate_attributes + self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. - :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is encrypted, the password used + :ivar base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need to + contain the private key. Required. + :vartype base64_encoded_certificate: str + :ivar 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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :vartype password: str + :ivar certificate_policy: The management policy for the certificate. + :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :ivar certificate_attributes: The attributes of the certificate (optional). + :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need + to contain the private key. Required. + :paramtype base64_encoded_certificate: str + :keyword password: If the private key in base64EncodedCertificate is encrypted, the password + used for encryption. + :paramtype password: str + :keyword certificate_policy: The management policy for the certificate. + :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword certificate_attributes: The attributes of the certificate (optional). + :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__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): +class CertificateIssuerItem(_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 + :ivar id: Certificate Identifier. + :vartype id: str + :ivar provider: The issuer provider. + :vartype provider: str """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): - super(CertificateIssuerItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.provider = kwargs.get('provider', None) + """ + :keyword id: Certificate Identifier. + :paramtype id: str + :keyword provider: The issuer provider. + :paramtype provider: str + """ + super().__init__(**kwargs) + self.id = id + self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -349,124 +445,167 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_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_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 + :ivar provider: The issuer provider. Required. + :vartype provider: str + :ivar credentials: The credentials to be used for the issuer. + :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :ivar organization_details: Details of the organization as provided to the issuer. + :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :ivar attributes: Attributes of the issuer object. + :vartype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ _validation = { - 'provider': {'required': True}, + "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'}, + "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["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **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) + """ + :keyword provider: The issuer provider. Required. + :paramtype provider: str + :keyword credentials: The credentials to be used for the issuer. + :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :keyword organization_details: Details of the organization as provided to the issuer. + :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :keyword attributes: Attributes of the issuer object. + :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes + """ + super().__init__(**kwargs) + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_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 attributes: Attributes of the issuer object. - :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes + :ivar provider: The issuer provider. + :vartype provider: str + :ivar credentials: The credentials to be used for the issuer. + :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :ivar organization_details: Details of the organization as provided to the issuer. + :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :ivar attributes: Attributes of the issuer object. + :vartype attributes: ~azure.keyvault.v7_1.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'}, + "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["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **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) + """ + :keyword provider: The issuer provider. + :paramtype provider: str + :keyword credentials: The credentials to be used for the issuer. + :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :keyword organization_details: Details of the organization as provided to the issuer. + :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :keyword attributes: Attributes of the issuer object. + :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes + """ + super().__init__(**kwargs) + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_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: 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 + :ivar id: Certificate identifier. + :vartype id: str + :ivar attributes: The certificate management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype 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'}, + "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, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, **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) + """ + :keyword id: Certificate identifier. + :paramtype id: str + :keyword attributes: The certificate management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword x509_thumbprint: Thumbprint of the certificate. + :paramtype x509_thumbprint: bytes + """ + super().__init__(**kwargs) + self.id = id + self.attributes = attributes + self.tags = tags + self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -479,303 +618,387 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_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_1.models.CertificateAttributes - :param tags: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] + :ivar certificate_attributes: The attributes of the certificate (optional). + :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "x509_certificates": {"key": "x5c", "type": "[bytearray]"}, + "certificate_attributes": {"key": "attributes", "type": "CertificateAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, + *, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] + :keyword certificate_attributes: The attributes of the certificate (optional). + :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.x509_certificates = x509_certificates + self.certificate_attributes = certificate_attributes + self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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_1.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in the certificate + :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :vartype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters + :ivar 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 + :vartype csr: bytes + :ivar 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_1.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 + :vartype cancellation_requested: bool + :ivar status: Status of the certificate operation. + :vartype status: str + :ivar status_details: The status details of the certificate operation. + :vartype status_details: str + :ivar error: Error encountered, if any, during the certificate operation. + :vartype error: ~azure.keyvault.v7_1.models.Error + :ivar target: Location which contains the result of the certificate operation. + :vartype target: str + :ivar request_id: Identifier for the certificate operation. + :vartype request_id: str """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, + cancellation_requested: Optional[bool] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + error: Optional["_models.Error"] = None, + target: Optional[str] = None, + request_id: Optional[str] = None, **kwargs ): - super(CertificateOperation, self).__init__(**kwargs) + """ + :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :paramtype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters + :keyword csr: The certificate signing request (CSR) that is being used in the certificate + operation. + :paramtype csr: bytes + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :paramtype cancellation_requested: bool + :keyword status: Status of the certificate operation. + :paramtype status: str + :keyword status_details: The status details of the certificate operation. + :paramtype status_details: str + :keyword error: Error encountered, if any, during the certificate operation. + :paramtype error: ~azure.keyvault.v7_1.models.Error + :keyword target: Location which contains the result of the certificate operation. + :paramtype target: str + :keyword request_id: Identifier for the certificate operation. + :paramtype request_id: str + """ + super().__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) + 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): +class CertificateOperationUpdateParameter(_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 + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. + :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) - self.cancellation_requested = kwargs['cancellation_requested'] + def __init__(self, *, cancellation_requested: bool, **kwargs): + """ + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. + :paramtype cancellation_requested: bool + """ + super().__init__(**kwargs) + self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_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_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 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 + :ivar key_properties: Properties of the key backing a certificate. + :vartype key_properties: ~azure.keyvault.v7_1.models.KeyProperties + :ivar secret_properties: Properties of the secret backing a certificate. + :vartype secret_properties: ~azure.keyvault.v7_1.models.SecretProperties + :ivar x509_certificate_properties: Properties of the X509 component of a certificate. + :vartype x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties + :ivar 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. - :type issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :param attributes: The certificate attributes. - :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :vartype lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] + :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :vartype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters + :ivar attributes: The certificate attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): - super(CertificatePolicy, self).__init__(**kwargs) + """ + :keyword key_properties: Properties of the key backing a certificate. + :paramtype key_properties: ~azure.keyvault.v7_1.models.KeyProperties + :keyword secret_properties: Properties of the secret backing a certificate. + :paramtype secret_properties: ~azure.keyvault.v7_1.models.SecretProperties + :keyword x509_certificate_properties: Properties of the X509 component of a certificate. + :paramtype x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties + :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a + certificate. + :paramtype lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] + :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :paramtype issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters + :keyword attributes: The certificate attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + """ + super().__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) + 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): +class CertificateRestoreParameters(_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 + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. + :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): + """ + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. + :paramtype certificate_bundle_backup: bytes + """ + super().__init__(**kwargs) + self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar certificate_policy: The management policy for the certificate. + :vartype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :ivar certificate_attributes: The attributes of the certificate (optional). + :vartype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "certificate_policy": {"key": "policy", "type": "CertificatePolicy"}, + "certificate_attributes": {"key": "attributes", "type": "CertificateAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, + *, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword certificate_policy: The management policy for the certificate. + :paramtype certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword certificate_attributes: The attributes of the certificate (optional). + :paramtype certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.certificate_policy = certificate_policy + self.certificate_attributes = certificate_attributes + self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_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 + :ivar email_address: Email address. + :vartype email_address: str + :ivar name: Name. + :vartype name: str + :ivar phone: Phone number. + :vartype phone: str """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "email_address": {"key": "email", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, } def __init__( - self, - **kwargs + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **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) + """ + :keyword email_address: Email address. + :paramtype email_address: str + :keyword name: Name. + :paramtype name: str + :keyword phone: Phone number. + :paramtype phone: str + """ + super().__init__(**kwargs) + self.email_address = email_address + self.name = name + self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_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_1.models.Contact] + :ivar contact_list: The contact list for the vault certificates. + :vartype contact_list: list[~azure.keyvault.v7_1.models.Contact] """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - **kwargs - ): - super(Contacts, self).__init__(**kwargs) + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): + """ + :keyword contact_list: The contact list for the vault certificates. + :paramtype contact_list: list[~azure.keyvault.v7_1.models.Contact] + """ + super().__init__(**kwargs) self.id = None - self.contact_list = kwargs.get('contact_list', None) + self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): - # pylint: disable=line-too-long +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -790,17 +1013,17 @@ class DeletedCertificateBundle(CertificateBundle): :vartype x509_thumbprint: bytes :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_1.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_1.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 + :ivar cer: CER contents of x509 certificate. + :vartype cer: bytes + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The certificate attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. - :type recovery_id: str + :vartype 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. @@ -808,36 +1031,55 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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[bytes] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedCertificateBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword cer: CER contents of x509 certificate. + :paramtype cer: bytes + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The certificate attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :paramtype recovery_id: str + """ + super().__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 @@ -847,17 +1089,17 @@ class DeletedCertificateItem(CertificateItem): 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: 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 + :ivar id: Certificate identifier. + :vartype id: str + :ivar attributes: The certificate management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype x509_thumbprint: bytes + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. - :type recovery_id: str + :vartype 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. @@ -865,31 +1107,50 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedCertificateItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword id: Certificate identifier. + :paramtype id: str + :keyword attributes: The certificate management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword x509_thumbprint: Thumbprint of the certificate. + :paramtype x509_thumbprint: bytes + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :paramtype recovery_id: str + """ + super().__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): +class DeletedCertificateListResult(_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. @@ -902,25 +1163,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -934,34 +1193,32 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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 enabled: Determines whether the issuer is enabled. + :vartype enabled: bool :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -969,158 +1226,213 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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) + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Determines whether the issuer is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_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_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 + :ivar provider: The issuer provider. + :vartype provider: str + :ivar credentials: The credentials to be used for the issuer. + :vartype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :ivar organization_details: Details of the organization as provided to the issuer. + :vartype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :ivar attributes: Attributes of the issuer object. + :vartype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): - super(IssuerBundle, self).__init__(**kwargs) + """ + :keyword provider: The issuer provider. + :paramtype provider: str + :keyword credentials: The credentials to be used for the issuer. + :paramtype credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :keyword organization_details: Details of the organization as provided to the issuer. + :paramtype organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :keyword attributes: Attributes of the issuer object. + :paramtype attributes: ~azure.keyvault.v7_1.models.IssuerAttributes + """ + super().__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.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_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 + :ivar account_id: The user name/account name/account id. + :vartype account_id: str + :ivar password: The password/secret/account key. + :vartype password: str """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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) + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): + """ + :keyword account_id: The user name/account name/account id. + :paramtype account_id: str + :keyword password: The password/secret/account key. + :paramtype password: str + """ + super().__init__(**kwargs) + self.account_id = account_id + self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_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 + :ivar 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 + :vartype name: str + :ivar 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 + :vartype certificate_type: str + :ivar certificate_transparency: Indicates if the certificates generated under this policy should be published to certificate transparency logs. - :type certificate_transparency: bool + :vartype certificate_transparency: bool """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "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 = kwargs.get('name', None) - self.certificate_type = kwargs.get('certificate_type', None) - self.certificate_transparency = kwargs.get('certificate_transparency', None) + """ + :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. + :paramtype name: str + :keyword certificate_type: Certificate type as supported by the provider (optional); for + example 'OV-SSL', 'EV-SSL'. + :paramtype certificate_type: str + :keyword certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. + :paramtype certificate_transparency: bool + """ + super().__init__(**kwargs) + self.name = name + self.certificate_type = certificate_type + self.certificate_transparency = certificate_transparency -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. - :param exportable: Not supported in this version. 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 + :ivar exportable: Not supported in this version. Indicates if the private key can be exported. + :vartype exportable: bool + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. + :vartype reuse_key: bool + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". + :vartype 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'}, + "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, "_models.JsonWebKeyType"]] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **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) + """ + :keyword exportable: Not supported in this version. Indicates if the private key can be + exported. + :paramtype exportable: bool + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. + :paramtype reuse_key: bool + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". + :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + """ + super().__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): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1130,68 +1442,80 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_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_1.models.Trigger - :param action: The action that will be executed. - :type action: ~azure.keyvault.v7_1.models.Action + :ivar trigger: The condition that will execute the action. + :vartype trigger: ~azure.keyvault.v7_1.models.Trigger + :ivar action: The action that will be executed. + :vartype action: ~azure.keyvault.v7_1.models.Action """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): - super(LifetimeAction, self).__init__(**kwargs) - self.trigger = kwargs.get('trigger', None) - self.action = kwargs.get('action', None) + """ + :keyword trigger: The condition that will execute the action. + :paramtype trigger: ~azure.keyvault.v7_1.models.Trigger + :keyword action: The action that will be executed. + :paramtype action: ~azure.keyvault.v7_1.models.Action + """ + super().__init__(**kwargs) + self.trigger = trigger + self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_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] + :ivar id: Id of the organization. + :vartype id: str + :ivar admin_details: Details of the organization administrator. + :vartype admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "id": {"key": "id", "type": "str"}, + "admin_details": {"key": "admin_details", "type": "[AdministratorDetails]"}, } def __init__( self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): - super(OrganizationDetails, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.admin_details = kwargs.get('admin_details', None) + """ + :keyword id: Id of the organization. + :paramtype id: str + :keyword admin_details: Details of the organization administrator. + :paramtype admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] + """ + super().__init__(**kwargs) + self.id = id + self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1201,230 +1525,168 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. - :param content_type: The media type (MIME type). - :type content_type: str + :ivar content_type: The media type (MIME type). + :vartype content_type: str """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) + def __init__(self, *, content_type: Optional[str] = None, **kwargs): + """ + :keyword content_type: The media type (MIME type). + :paramtype content_type: str + """ + super().__init__(**kwargs) + self.content_type = content_type -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_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] + :ivar emails: Email addresses. + :vartype emails: list[str] + :ivar dns_names: Domain names. + :vartype dns_names: list[str] + :ivar upns: User principal names. + :vartype upns: list[str] """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "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 = kwargs.get('emails', None) - self.dns_names = kwargs.get('dns_names', None) - self.upns = kwargs.get('upns', None) + """ + :keyword emails: Email addresses. + :paramtype emails: list[str] + :keyword dns_names: Domain names. + :paramtype dns_names: list[str] + :keyword upns: User principal names. + :paramtype upns: list[str] + """ + super().__init__(**kwargs) + self.emails = emails + self.dns_names = dns_names + self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_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 + :ivar 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 + :vartype lifetime_percentage: int + :ivar 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 + :vartype days_before_expiry: int """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "lifetime_percentage": {"key": "lifetime_percentage", "type": "int"}, + "days_before_expiry": {"key": "days_before_expiry", "type": "int"}, } def __init__( - self, - **kwargs + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): - super(Trigger, self).__init__(**kwargs) - self.lifetime_percentage = kwargs.get('lifetime_percentage', None) - self.days_before_expiry = kwargs.get('days_before_expiry', None) + """ + :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be + between 1 and 99. + :paramtype lifetime_percentage: int + :keyword 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). + :paramtype days_before_expiry: int + """ + super().__init__(**kwargs) + self.lifetime_percentage = lifetime_percentage + self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_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_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. - :type validity_in_months: int + :ivar subject: The subject name. Should be a valid X509 distinguished Name. + :vartype subject: str + :ivar ekus: The enhanced key usage. + :vartype ekus: list[str] + :ivar subject_alternative_names: The subject alternative names. + :vartype subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames + :ivar key_usage: List of key usages. + :vartype key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] + :ivar validity_in_months: The duration that the certificate is valid in months. + :vartype validity_in_months: int """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, + validity_in_months: Optional[int] = None, **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) - - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ - - EMAIL_CONTACTS = "EmailContacts" - AUTO_RENEW = "AutoRenew" - -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, 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. - """ - - #: Denotes a vault state in which deletion is an irreversible operation, without the possibility - #: for recovery. This level corresponds to no protection being available against a Delete - #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). - PURGEABLE = "Purgeable" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity - #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted - #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE = "Recoverable" - #: Denotes a vault and subscription state in which deletion is recoverable within retention - #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in - #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. - RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees - #: the recoverability of the deleted entity during the retention interval, unless a Purge - #: operation is requested, or the subscription is cancelled. - CUSTOMIZED_RECOVERABLE_PURGEABLE = "CustomizedRecoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level - #: guarantees the recoverability of the deleted entity during the retention interval and while the - #: subscription is still available. - CUSTOMIZED_RECOVERABLE = "CustomizedRecoverable" - #: Denotes a vault and subscription state in which deletion is recoverable, immediate and - #: permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot - #: be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the - #: recoverability of the deleted entity during the retention interval, and also reflects the fact - #: that the subscription itself cannot be cancelled. - CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" - -class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, 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(with_metaclass(_CaseInsensitiveEnumMeta, 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" - -class KeyUsageType(with_metaclass(_CaseInsensitiveEnumMeta, 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" + :keyword subject: The subject name. Should be a valid X509 distinguished Name. + :paramtype subject: str + :keyword ekus: The enhanced key usage. + :paramtype ekus: list[str] + :keyword subject_alternative_names: The subject alternative names. + :paramtype subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames + :keyword key_usage: List of key usages. + :paramtype key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] + :keyword validity_in_months: The duration that the certificate is valid in months. + :paramtype validity_in_months: int + """ + super().__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/setup.py b/sdk/keyvault/azure-keyvault-certificates/setup.py index 13fc580f7f07..795d5e903699 100644 --- a/sdk/keyvault/azure-keyvault-certificates/setup.py +++ b/sdk/keyvault/azure-keyvault-certificates/setup.py @@ -67,8 +67,7 @@ ), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.20.0", - "msrest>=0.6.21", + "azure-core<2.0.0,>=1.24.0", "azure-common~=1.1", "six>=1.11.0", ], diff --git a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md index 330376fbf951..00f3fcb87b19 100644 --- a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs Fixed ### Other Changes +- Dropped `msrest` requirement ## 4.8.0b1 (2022-09-22) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/__init__.py index a6c1f9b7a792..f81543eeed02 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_configuration.py index 4a4fcbedaa26..8d4e90f2c212 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_configuration.py @@ -8,31 +8,40 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential """ def __init__( self, + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -45,8 +54,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_key_vault_client.py index e3991885bc73..0bcd326a07e5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_key_vault_client.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from azure.core.credentials import TokenCredential class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -41,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -117,6 +119,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "TokenCredential", api_version=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any @@ -125,8 +128,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_operations_mixin.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_operations_mixin.py index 636312ef5619..d99997763737 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_operations_mixin.py @@ -8,39 +8,36 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import TYPE_CHECKING +from ._serialization import Serializer, Deserializer +from typing import Any, IO, Iterable, Optional, Union -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable, Optional +from azure.core.paging import ItemPaged - from azure.core.paging import ItemPaged +from . import models as _models class KeyVaultClientOperationsMixin(object): def backup_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -57,11 +54,10 @@ def backup_certificate( def backup_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -76,14 +72,14 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -108,24 +104,23 @@ def backup_key( def backup_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -144,24 +139,23 @@ def backup_secret( def backup_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -178,27 +172,30 @@ def backup_storage_account( def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -217,29 +214,32 @@ def create_certificate( def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -264,13 +264,12 @@ def create_key( def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -280,18 +279,22 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -316,25 +319,24 @@ def decrypt( def delete_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -353,21 +355,20 @@ def delete_certificate( def delete_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -386,24 +387,23 @@ def delete_certificate_contacts( def delete_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -422,25 +422,24 @@ def delete_certificate_issuer( def delete_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -459,11 +458,10 @@ def delete_certificate_operation( def delete_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -471,14 +469,14 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -503,25 +501,24 @@ def delete_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -540,24 +537,23 @@ def delete_sas_definition( def delete_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -576,21 +572,20 @@ def delete_secret( def delete_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -609,13 +604,12 @@ def delete_storage_account( def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -627,18 +621,22 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -663,27 +661,26 @@ def encrypt( def get_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -702,21 +699,20 @@ def get_certificate( def get_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -735,25 +731,24 @@ def get_certificate_contacts( def get_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -772,28 +767,26 @@ def get_certificate_issuer( def get_certificate_issuers( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -812,24 +805,23 @@ def get_certificate_issuers( def get_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -848,24 +840,23 @@ def get_certificate_operation( def get_certificate_policy( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -884,29 +875,27 @@ def get_certificate_policy( 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"] + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -925,26 +914,24 @@ def get_certificate_versions( def get_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -963,25 +950,24 @@ def get_certificates( def get_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -1000,11 +986,10 @@ def get_deleted_certificate( def get_deleted_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -1012,17 +997,16 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -1041,25 +1025,24 @@ def get_deleted_certificates( def get_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1084,11 +1067,10 @@ def get_deleted_key( def get_deleted_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -1097,16 +1079,15 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_3.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1131,27 +1112,26 @@ def get_deleted_keys( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1168,30 +1148,28 @@ def get_deleted_sas_definition( def get_deleted_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1208,24 +1186,23 @@ def get_deleted_sas_definitions( def get_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1244,27 +1221,24 @@ def get_deleted_secret( def get_deleted_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1283,24 +1257,23 @@ def get_deleted_secrets( def get_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1317,26 +1290,25 @@ def get_deleted_storage_account( def get_deleted_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1353,28 +1325,28 @@ def get_deleted_storage_accounts( def get_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1399,24 +1371,23 @@ def get_key( def get_key_rotation_policy( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyRotationPolicy" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _models.KeyRotationPolicy: """Lists the policy for a key. The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key 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. Required. :type vault_base_url: str - :param key_name: The name of the key in a given key vault. + :param key_name: The name of the key in a given key vault. Required. :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_rotation_policy') if api_version == '7.3': @@ -1433,28 +1404,27 @@ def get_key_rotation_policy( def get_key_versions( self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1479,11 +1449,10 @@ def get_key_versions( def get_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1491,15 +1460,15 @@ def get_keys( 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. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1524,23 +1493,26 @@ def get_keys( def get_random_bytes( self, - vault_base_url, # type: str - parameters, # type: "_models.GetRandomBytesRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RandomBytes" + vault_base_url: str, + parameters: Union[_models.GetRandomBytesRequest, IO], + **kwargs: Any + ) -> _models.RandomBytes: """Get the requested number of bytes containing random values. Get the requested number of bytes containing random values from a managed HSM. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The request object to get random bytes. - :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest + :param parameters: The request object to get random bytes. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RandomBytes, or the result of cls(response) + :return: RandomBytes or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RandomBytes - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_random_bytes') if api_version == '7.3': @@ -1557,25 +1529,24 @@ def get_random_bytes( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1594,28 +1565,25 @@ def get_sas_definition( def get_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1634,27 +1602,26 @@ def get_sas_definitions( def get_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1673,28 +1640,27 @@ def get_secret( def get_secret_versions( self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1713,26 +1679,25 @@ def get_secret_versions( def get_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1751,22 +1716,21 @@ def get_secrets( def get_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1785,23 +1749,22 @@ def get_storage_account( def get_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1820,12 +1783,11 @@ def get_storage_accounts( def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1833,16 +1795,20 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1861,12 +1827,11 @@ def import_certificate( def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyImportParameters, IO], + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1874,16 +1839,20 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1908,28 +1877,31 @@ def import_key( def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1948,25 +1920,24 @@ def merge_certificate( def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1985,25 +1956,24 @@ def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements def purge_deleted_key( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -2028,25 +1998,24 @@ def purge_deleted_key( # pylint: disable=inconsistent-return-statements def purge_deleted_secret( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -2065,25 +2034,24 @@ def purge_deleted_secret( # pylint: disable=inconsistent-return-statements def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -2100,11 +2068,10 @@ def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statem def recover_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2112,14 +2079,14 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2138,11 +2105,10 @@ def recover_deleted_certificate( def recover_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. @@ -2150,14 +2116,14 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2182,28 +2148,27 @@ def recover_deleted_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2220,24 +2185,23 @@ def recover_deleted_sas_definition( def recover_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2256,25 +2220,24 @@ def recover_deleted_secret( def recover_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2291,25 +2254,28 @@ def recover_deleted_storage_account( def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2328,30 +2294,34 @@ def regenerate_storage_account_key( def release( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyReleaseParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyReleaseResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyReleaseParameters, IO], + **kwargs: Any + ) -> _models.KeyReleaseResult: """Releases a key. The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :type key_version: str - :param parameters: The parameters for the key release operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyReleaseResult, or the result of cls(response) + :param parameters: The parameters for the key release operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('release') if api_version == '7.3': @@ -2368,24 +2338,27 @@ def release( def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: Union[_models.CertificateRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2402,11 +2375,10 @@ def restore_certificate( def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: Union[_models.KeyRestoreParameters, IO], + **kwargs: Any + ) -> _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, @@ -2420,14 +2392,18 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2452,24 +2428,27 @@ def restore_key( def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: Union[_models.SecretRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2488,24 +2467,27 @@ def restore_secret( def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: Union[_models.StorageRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2522,26 +2504,25 @@ def restore_storage_account( def rotate_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _models.KeyBundle: """Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param key_name: The name of key to be rotated. The system will generate a new version in the - specified key. + specified key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('rotate_key') if api_version == '7.3': @@ -2558,24 +2539,27 @@ def rotate_key( def set_certificate_contacts( self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + contacts: Union[_models.Contacts, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2594,27 +2578,30 @@ def set_certificate_contacts( def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2633,28 +2620,31 @@ def set_certificate_issuer( def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2673,28 +2663,31 @@ def set_sas_definition( def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: Union[_models.SecretSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2713,24 +2706,27 @@ def set_secret( def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2749,31 +2745,34 @@ def set_storage_account( def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2798,13 +2797,12 @@ def sign( def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -2812,18 +2810,22 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2848,31 +2850,34 @@ def unwrap_key( def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2891,27 +2896,30 @@ def update_certificate( def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2930,28 +2938,31 @@ def update_certificate_issuer( def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2970,27 +2981,30 @@ def update_certificate_operation( 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -3009,13 +3023,12 @@ def update_certificate_policy( def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -3023,18 +3036,22 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -3059,27 +3076,30 @@ def update_key( def update_key_rotation_policy( self, - vault_base_url, # type: str - key_name, # type: str - key_rotation_policy, # type: "_models.KeyRotationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyRotationPolicy" + vault_base_url: str, + key_name: str, + key_rotation_policy: Union[_models.KeyRotationPolicy, IO], + **kwargs: Any + ) -> _models.KeyRotationPolicy: """Updates the rotation policy for a key. Set specified members in the key policy. Leave others as undefined. This operation requires the keys/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. Required. :type vault_base_url: str - :param key_name: The name of the key in the given vault. + :param key_name: The name of the key in the given vault. Required. :type key_name: str - :param key_rotation_policy: The policy for the key. - :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :param key_rotation_policy: The policy for the key. Is either a model type or a IO type. + Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key_rotation_policy') if api_version == '7.3': @@ -3096,28 +3116,31 @@ def update_key_rotation_policy( def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -3136,31 +3159,34 @@ def update_sas_definition( def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -3179,25 +3205,28 @@ def update_secret( def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -3216,13 +3245,12 @@ def update_storage_account( def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3231,18 +3259,22 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -3267,13 +3299,12 @@ def verify( def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3283,18 +3314,22 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_serialization.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_serialization.py new file mode 100644 index 000000000000..240df16c57f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, 'read'): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding='utf-8-sig') + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if 'content-type' in headers: + content_type = headers['content-type'].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds()/3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + +try: + from datetime import timezone + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0 + } + + def __init__(self, classes=None): + self.serialize_type = { + 'iso-8601': Serializer.serialize_iso, + 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, + 'duration': Serializer.serialize_duration, + 'date': Serializer.serialize_date, + 'time': Serializer.serialize_time, + 'decimal': Serializer.serialize_decimal, + 'long': Serializer.serialize_long, + 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, + 'object': self.serialize_object, + '[]': self.serialize_iter, + '{}': self.serialize_dict + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data( + target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data( + target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == '': + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) + + + if is_xml_model_serialization: + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + xml_prefix = xml_desc.get('prefix', None) + xml_ns = xml_desc.get('ns', None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if 'name' not in getattr(orig_attr, '_xml_map', {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node( + xml_name, + xml_prefix, + xml_ns + ) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format( + attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip('[]{}') + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback( + SerializationError, "Unable to build a model: "+str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [ + self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" + for d + in data + ] + if not kwargs.get('skip_quote', False): + data = [ + quote(str(d), safe='') + for d + in data + ] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ['[str]']: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type]( + data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback( + SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == 'str': + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ['' if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if 'xml' in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get('xml', {}) + xml_name = xml_desc.get('name') + if not xml_name: + xml_name = serialization_ctxt['key'] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node( + node_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data( + value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if 'xml' in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt['xml'] + xml_name = xml_desc['name'] + + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object( + value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object( + obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode('ascii') + return encoded.strip('=').replace('+', '-').replace('/', '_') + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], utc.tm_mday, + Serializer.months[utc.tm_mon], utc.tm_year, + utc.tm_hour, utc.tm_min, utc.tm_sec) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + if microseconds: + microseconds = '.'+microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + microseconds + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + return working_data.get(key) + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + + # Look for a children + is_iter_type = attr_desc['type'].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + )) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + + valid_date = re.compile( + r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' + r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + + def __init__(self, classes=None): + self.deserialize_type = { + 'iso-8601': Deserializer.deserialize_iso, + 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, + 'duration': Deserializer.deserialize_duration, + 'date': Deserializer.deserialize_date, + 'time': Deserializer.deserialize_time, + 'decimal': Deserializer.deserialize_decimal, + 'long': Deserializer.deserialize_long, + 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, + 'object': self.deserialize_object, + '[]': self.deserialize_iter, + '{}': self.deserialize_dict + } + self.deserialize_expected_types = { + 'duration': (isodate.Duration, datetime.timedelta), + 'iso-8601': (datetime.datetime) + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [ + rest_key_extractor, + xml_key_extractor + ] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, '_validation', {}).items() + if config.get('constant')] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig['type'] + internal_data_type = local_type.strip('[]{}') + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr( + data, + attr, + self._deserialize(local_type, value) + ) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == '': + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip('[]{}') + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ("Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning( + msg, + found_value, + key_extractor, + attr + ) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc['type']) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) + for desc in attribute_map.values() if desc['key'] != ''} + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + #Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text(), + raw_data.headers + ) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, '_content_consumed'): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text, + raw_data.headers + ) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, '_subtype_map', {}) + try: + readonly = [k for k, v in response._validation.items() + if v.get('readonly')] + const = [k for k, v in response._validation.items() + if v.get('constant')] + kwargs = {k: v for k, v in attrs.items() + if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format( + kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( + iter_type, + type(attr) + )) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, 'str') + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object( + value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object( + obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return '' + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == 'bool': + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ['true', '1']: + return True + elif attr.lower() in ['false', '0']: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == 'str': + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], + tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split('.') + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_configuration.py index 618024f0b97c..08735390ee1c 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_configuration.py @@ -8,26 +8,39 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ def __init__( self, + credential: "AsyncTokenCredential", **kwargs # type: Any ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -39,8 +52,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_key_vault_client.py index 5674834d6f4d..13618472ba8a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_key_vault_client.py @@ -9,17 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -37,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -113,6 +119,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "AsyncTokenCredential", api_version: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any @@ -121,8 +128,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_operations_mixin.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_operations_mixin.py index 9bd9dc22847b..0a7ebac71bf8 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/aio/_operations_mixin.py @@ -8,11 +8,13 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Optional +from .._serialization import Serializer, Deserializer +from typing import Any, AsyncIterable, IO, Optional, Union from azure.core.async_paging import AsyncItemPaged +from .. import models as _models + class KeyVaultClientOperationsMixin(object): @@ -21,21 +23,21 @@ async def backup_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.BackupCertificateResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -55,7 +57,7 @@ async def backup_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.BackupKeyResult": + ) -> _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 @@ -70,14 +72,14 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -105,20 +107,20 @@ async def backup_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.BackupSecretResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -140,20 +142,20 @@ async def backup_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.BackupStorageResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -172,24 +174,28 @@ async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -210,26 +216,30 @@ async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -257,9 +267,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -269,18 +279,22 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -308,21 +322,21 @@ async def delete_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -343,18 +357,18 @@ async def delete_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -376,20 +390,20 @@ async def delete_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -411,21 +425,21 @@ async def delete_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -447,7 +461,7 @@ async def delete_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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 @@ -455,14 +469,14 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -491,20 +505,20 @@ async def delete_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -526,20 +540,20 @@ async def delete_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -561,17 +575,17 @@ async def delete_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -593,9 +607,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -607,18 +621,22 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -647,22 +665,22 @@ async def get_certificate( certificate_name: str, certificate_version: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -683,18 +701,18 @@ async def get_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -716,21 +734,21 @@ async def get_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -752,24 +770,24 @@ def get_certificate_issuers( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -791,20 +809,20 @@ async def get_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -826,20 +844,20 @@ async def get_certificate_policy( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -862,25 +880,24 @@ def get_certificate_versions( certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -902,23 +919,22 @@ def get_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -940,21 +956,21 @@ async def get_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -976,7 +992,7 @@ def get_deleted_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -984,17 +1000,17 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -1016,21 +1032,21 @@ async def get_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1058,7 +1074,7 @@ def get_deleted_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1067,17 +1083,15 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_3.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1106,22 +1120,22 @@ async def get_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1142,25 +1156,25 @@ def get_deleted_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1180,20 +1194,20 @@ async def get_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1215,23 +1229,22 @@ def get_deleted_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1253,20 +1266,20 @@ async def get_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.DeletedStorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1286,23 +1299,23 @@ def get_deleted_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1323,23 +1336,24 @@ async def get_key( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1367,20 +1381,20 @@ async def get_key_rotation_policy( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.KeyRotationPolicy": + ) -> _models.KeyRotationPolicy: """Lists the policy for a key. The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key 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. Required. :type vault_base_url: str - :param key_name: The name of the key in a given key vault. + :param key_name: The name of the key in a given key vault. Required. :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_rotation_policy') if api_version == '7.3': @@ -1401,23 +1415,23 @@ def get_key_versions( key_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1445,7 +1459,7 @@ def get_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1453,15 +1467,15 @@ def get_keys( 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. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1487,21 +1501,25 @@ def get_keys( async def get_random_bytes( self, vault_base_url: str, - parameters: "_models.GetRandomBytesRequest", + parameters: Union[_models.GetRandomBytesRequest, IO], **kwargs: Any - ) -> "_models.RandomBytes": + ) -> _models.RandomBytes: """Get the requested number of bytes containing random values. Get the requested number of bytes containing random values from a managed HSM. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The request object to get random bytes. - :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest + :param parameters: The request object to get random bytes. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RandomBytes, or the result of cls(response) + :return: RandomBytes or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RandomBytes - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_random_bytes') if api_version == '7.3': @@ -1522,20 +1540,20 @@ async def get_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1558,23 +1576,22 @@ def get_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1597,22 +1614,22 @@ async def get_secret( secret_name: str, secret_version: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1635,24 +1652,23 @@ def get_secret_versions( secret_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1674,23 +1690,22 @@ def get_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1712,18 +1727,18 @@ async def get_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1745,20 +1760,20 @@ def get_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1779,9 +1794,9 @@ async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1789,16 +1804,20 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1819,9 +1838,9 @@ async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1829,16 +1848,20 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1865,25 +1888,29 @@ async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1912,14 +1939,14 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1948,14 +1975,14 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -1990,14 +2017,14 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -2026,14 +2053,14 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -2053,7 +2080,7 @@ async def recover_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2061,14 +2088,14 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2090,7 +2117,7 @@ async def recover_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2098,14 +2125,14 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2134,23 +2161,23 @@ async def recover_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2170,20 +2197,20 @@ async def recover_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2205,21 +2232,21 @@ async def recover_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2238,22 +2265,26 @@ async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2275,26 +2306,31 @@ async def release( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyReleaseParameters", + parameters: Union[_models.KeyReleaseParameters, IO], **kwargs: Any - ) -> "_models.KeyReleaseResult": + ) -> _models.KeyReleaseResult: """Releases a key. The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :type key_version: str - :param parameters: The parameters for the key release operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyReleaseResult, or the result of cls(response) + :param parameters: The parameters for the key release operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('release') if api_version == '7.3': @@ -2312,22 +2348,26 @@ async def release( async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2345,9 +2385,9 @@ async def restore_certificate( async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -2361,14 +2401,18 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2394,22 +2438,26 @@ async def restore_key( async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2429,22 +2477,26 @@ async def restore_secret( async def restore_storage_account( self, vault_base_url: str, - parameters: "_models.StorageRestoreParameters", + parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2464,22 +2516,22 @@ async def rotate_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param key_name: The name of key to be rotated. The system will generate a new version in the - specified key. + specified key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('rotate_key') if api_version == '7.3': @@ -2497,22 +2549,26 @@ async def rotate_key( async def set_certificate_contacts( self, vault_base_url: str, - contacts: "_models.Contacts", + contacts: Union[_models.Contacts, IO], **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2533,24 +2589,28 @@ async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: Union[_models.CertificateIssuerSetParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2572,24 +2632,28 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2610,25 +2674,29 @@ async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2649,21 +2717,25 @@ async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2685,27 +2757,31 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2733,9 +2809,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -2743,18 +2819,22 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2782,27 +2862,31 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2823,24 +2907,28 @@ async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2861,25 +2949,29 @@ async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2900,24 +2992,28 @@ async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -2939,9 +3035,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2949,18 +3045,22 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -2987,24 +3087,28 @@ async def update_key_rotation_policy( self, vault_base_url: str, key_name: str, - key_rotation_policy: "_models.KeyRotationPolicy", + key_rotation_policy: Union[_models.KeyRotationPolicy, IO], **kwargs: Any - ) -> "_models.KeyRotationPolicy": + ) -> _models.KeyRotationPolicy: """Updates the rotation policy for a key. Set specified members in the key policy. Leave others as undefined. This operation requires the keys/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. Required. :type vault_base_url: str - :param key_name: The name of the key in the given vault. + :param key_name: The name of the key in the given vault. Required. :type key_name: str - :param key_rotation_policy: The policy for the key. - :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :param key_rotation_policy: The policy for the key. Is either a model type or a IO type. + Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key_rotation_policy') if api_version == '7.3': @@ -3024,24 +3128,28 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -3063,27 +3171,31 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -3104,22 +3216,26 @@ async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -3141,9 +3257,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -3152,18 +3268,22 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -3191,9 +3311,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -3203,18 +3323,22 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_configuration.py index ea5a71f153da..0021ca88647e 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_key_vault_client.py index 84f121203cc4..aaa06cdeaa8e 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_metadata.json b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_metadata.json index 406f3aaab330..9a33701dda24 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_metadata.json +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,822 +65,889 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_vendor.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_configuration.py index 7bf8c5316293..3130095b65ea 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_key_vault_client.py index 281ae11c1dac..5515751f6d64 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py index 18cd4b2e2be5..697635d957c6 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,263 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_backup_secret_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_secret_request, build_regenerate_storage_account_key_request, build_restore_key_request, build_restore_secret_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_backup_secret_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_secret_request, + build_regenerate_storage_account_key_request, + build_restore_key_request, + build_restore_secret_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +270,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +411,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -239,9 +543,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +553,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +599,167 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +773,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,54 +800,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -549,33 +864,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -590,64 +896,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -661,59 +974,214 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def encrypt( @@ -721,9 +1189,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -735,29 +1203,45 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -765,35 +1249,110 @@ async def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def decrypt( @@ -801,9 +1360,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -813,29 +1372,45 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -843,35 +1418,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -879,38 +1523,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -918,35 +1578,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -954,9 +1687,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -965,29 +1698,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -995,35 +1744,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Wraps a symmetric key using a specified key. - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1031,9 +1855,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1043,29 +1867,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1073,35 +1913,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1109,9 +2020,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1119,29 +2030,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1149,43 +2076,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1194,55 +2119,58 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1256,96 +2184,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1353,60 +2274,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1414,190 +2335,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace_async + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -1605,38 +2674,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1644,164 +2729,166 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1815,91 +2902,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1913,87 +2994,83 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + if not next_link: - else: - request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2007,95 +3084,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2103,306 +3175,376 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2416,336 +3558,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2759,371 +3960,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3131,129 +4627,144 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3267,158 +4778,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3426,38 +5080,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3465,379 +5135,539 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3845,55 +5675,59 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: - else: - request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3907,96 +5741,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4004,60 +5833,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4065,115 +5896,121 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4187,414 +6024,629 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4608,155 +6660,215 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_sas_definition( @@ -4764,35 +6876,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -4800,35 +6928,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_sas_definition( @@ -4836,35 +7027,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -4872,32 +7079,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/__init__.py index 5f3be613a755..e95cdc3af87a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/__init__.py @@ -6,264 +6,186 @@ # 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 BackupKeyResult - from ._models_py3 import BackupSecretResult - 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 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 DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 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 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 ._models_py3 import Action +from ._models_py3 import AdministratorDetails +from ._models_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import BackupSecretResult +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 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 DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 SubjectAlternativeNames +from ._models_py3 import Trigger +from ._models_py3 import X509CertificateProperties -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupKeyResult', - 'BackupSecretResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - 'DeletedCertificateBundle', - 'DeletedCertificateItem', - 'DeletedCertificateListResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'IssuerAttributes', - 'IssuerBundle', - 'IssuerCredentials', - 'IssuerParameters', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'LifetimeAction', - 'OrganizationDetails', - 'PendingCertificateSigningRequestResult', - 'SasDefinitionAttributes', - 'SasDefinitionBundle', - 'SasDefinitionCreateParameters', - 'SasDefinitionItem', - 'SasDefinitionListResult', - 'SasDefinitionUpdateParameters', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'StorageAccountAttributes', - 'StorageAccountCreateParameters', - 'StorageAccountItem', - 'StorageAccountRegenerteKeyParameters', - 'StorageAccountUpdateParameters', - 'StorageBundle', - 'StorageListResult', - 'SubjectAlternativeNames', - 'Trigger', - 'X509CertificateProperties', - 'ActionType', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupKeyResult", + "BackupSecretResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "DeletedCertificateBundle", + "DeletedCertificateItem", + "DeletedCertificateListResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "IssuerAttributes", + "IssuerBundle", + "IssuerCredentials", + "IssuerParameters", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyRestoreParameters", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "LifetimeAction", + "OrganizationDetails", + "PendingCertificateSigningRequestResult", + "SasDefinitionAttributes", + "SasDefinitionBundle", + "SasDefinitionCreateParameters", + "SasDefinitionItem", + "SasDefinitionListResult", + "SasDefinitionUpdateParameters", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "StorageAccountAttributes", + "StorageAccountCreateParameters", + "StorageAccountItem", + "StorageAccountRegenerteKeyParameters", + "StorageAccountUpdateParameters", + "StorageBundle", + "StorageListResult", + "SubjectAlternativeNames", + "Trigger", + "X509CertificateProperties", + "ActionType", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_key_vault_client_enums.py index 5c095aa3ecb5..81cad1a34048 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -37,9 +36,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: deletion. RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -50,17 +49,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. SECP256_K1 = "SECP256K1" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -69,7 +68,8 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ @@ -86,9 +86,9 @@ class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, ES512 = "ES512" ECDSA256 = "ECDSA256" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JsonWebKey key type (kty). - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JsonWebKey key type (kty).""" EC = "EC" EC_HSM = "EC-HSM" @@ -96,7 +96,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA_HSM = "RSA-HSM" OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models.py deleted file mode 100644 index c1756054d9ee..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models.py +++ /dev/null @@ -1,3452 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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 CertificateAttributes(Attributes): - """The certificate management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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.v2016_10_01.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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.v2016_10_01.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v2016_10_01.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v2016_10_01.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - """ - 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 CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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.v2016_10_01.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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 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.v2016_10_01.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Type of certificate to be requested from the issuer provider. - :vartype certificate_type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Type of certificate to be requested from the issuer provider. - :paramtype certificate_type: str - """ - super(IssuerParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.certificate_type = kwargs.get('certificate_type', None) - - -class JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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.v2016_10_01.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The key type. - :vartype key_type: str - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The key type. - :paramtype key_type: str - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - """ - 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) - - -class KeyRestoreParameters(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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.v2016_10_01.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v2016_10_01.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v2016_10_01.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -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. - - :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. - :vartype parameters: dict[str, str] - :ivar attributes: The SAS definition attributes. - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.parameters = None - self.attributes = None - self.tags = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _validation = { - 'parameters': {'required': True}, - } - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.parameters = kwargs['parameters'] - self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) - self.tags = kwargs.get('tags', None) - - -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. - - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :ivar parameters: Sas definition update metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Sas definition update metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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.v2016_10_01.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(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. - - :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: A set of 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 StorageAccountRegenerteKeyParameters(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 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. - - :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.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] - """ - - _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 StorageListResult(msrest.serialization.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.v2016_10_01.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 SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: - ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models_py3.py index d6089212548c..92798f86dd32 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -152,24 +148,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -179,20 +171,16 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -214,24 +202,24 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and + "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -250,11 +238,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -270,55 +258,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -330,28 +318,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -360,22 +348,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :ivar base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -384,20 +372,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -405,14 +393,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :keyword base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -421,10 +409,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -432,7 +420,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -442,16 +430,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -459,12 +443,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -477,32 +461,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -513,27 +493,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -542,14 +522,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -563,19 +543,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -588,38 +568,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -629,19 +609,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -654,72 +634,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -730,7 +706,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -747,30 +723,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -780,7 +756,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -795,7 +771,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -807,40 +783,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -864,28 +835,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -904,7 +875,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -914,28 +885,28 @@ def __init__( self.attributes = attributes -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -944,16 +915,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -965,18 +936,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -986,13 +952,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1004,30 +970,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1043,12 +1004,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1060,54 +1021,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1122,7 +1083,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1136,25 +1097,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1165,7 +1126,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1173,13 +1134,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1192,27 +1153,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1221,7 +1178,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1229,21 +1186,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1252,10 +1209,10 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1271,7 +1228,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1286,26 +1243,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1315,19 +1272,19 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1336,7 +1293,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1344,21 +1301,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1367,10 +1324,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1386,7 +1343,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1401,26 +1358,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1430,19 +1387,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1455,27 +1412,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1488,7 +1441,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1499,27 +1452,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1532,10 +1485,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1558,7 +1511,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1576,32 +1529,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1615,19 +1568,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1636,7 +1589,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1646,22 +1599,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -1671,12 +1624,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -1693,7 +1646,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1710,27 +1663,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -1741,7 +1694,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -1749,13 +1702,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1768,27 +1721,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1802,30 +1751,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1839,33 +1784,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1883,24 +1823,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1913,7 +1853,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1921,7 +1861,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1931,29 +1871,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1964,17 +1898,11 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - certificate_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, certificate_type: Optional[str] = None, **kwargs): """ :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. @@ -1982,18 +1910,18 @@ def __init__( :keyword certificate_type: Type of certificate to be requested from the issuer provider. :paramtype certificate_type: str """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :ivar kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and + "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2017,8 +1945,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2027,29 +1955,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2061,7 +1989,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2069,8 +1997,8 @@ def __init__( """ :keyword kid: Key identifier. :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :keyword kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", + and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2094,15 +2022,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2138,25 +2066,25 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2175,17 +2103,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2193,40 +2121,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2234,13 +2162,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "SECP256K1". :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2249,59 +2177,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2314,27 +2242,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2346,68 +2270,58 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. @@ -2421,10 +2335,10 @@ class KeyProperties(msrest.serialization.Model): """ _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'}, + "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"}, } def __init__( @@ -2446,52 +2360,47 @@ def __init__( :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size self.reuse_key = reuse_key -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -2499,37 +2408,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -2537,21 +2440,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2561,16 +2464,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -2580,75 +2483,72 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2658,24 +2558,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -2685,16 +2581,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -2702,12 +2594,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v2016_10_01.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -2717,15 +2609,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -2734,12 +2626,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2749,24 +2641,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -2780,33 +2668,28 @@ class SasDefinitionAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -2819,33 +2702,29 @@ class SasDefinitionBundle(msrest.serialization.Model): :vartype parameters: dict[str, str] :ivar attributes: The SAS definition attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "parameters": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "parameters": {"key": "parameters", "type": "{str}"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.parameters = None @@ -2853,53 +2732,53 @@ def __init__( self.tags = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :ivar parameters: Sas definition creation metadata in the form of key-value pairs. Required. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'parameters': {'required': True}, + "parameters": {"required": True}, } _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Dict[str, str], - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :keyword parameters: Sas definition creation metadata in the form of key-value pairs. Required. :paramtype parameters: dict[str, str] :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -2910,38 +2789,34 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None self.tags = None -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2954,48 +2829,44 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :ivar parameters: Sas definition update metadata in the form of key-value pairs. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Optional[Dict[str, str]] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3005,10 +2876,10 @@ def __init__( :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags @@ -3032,24 +2903,24 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3068,11 +2939,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3085,27 +2956,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3113,62 +2980,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3177,14 +3034,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3193,48 +3050,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3243,16 +3100,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3266,66 +3123,61 @@ class StorageAccountAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3335,27 +3187,27 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3364,7 +3216,7 @@ def __init__( self.tags = tags -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -3375,69 +3227,60 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None self.tags = None -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -3449,16 +3292,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -3467,7 +3310,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3481,10 +3324,10 @@ def __init__( :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -3492,7 +3335,7 @@ def __init__( self.tags = tags -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -3509,37 +3352,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -3549,7 +3388,7 @@ def __init__( self.tags = None -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3562,27 +3401,23 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -3594,9 +3429,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -3615,13 +3450,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -3634,20 +3469,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -3658,12 +3489,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -3679,15 +3510,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -3695,8 +3526,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -3713,7 +3544,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_key_vault_client_operations.py index 2f19f8e0841e..74c50773e8a5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_key_vault_client_operations.py @@ -6,2396 +6,1898 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" - # Construct URL + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2403,71 +1905,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2475,67 +2046,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2543,29 +2188,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2573,169 +2234,167 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2749,34 +2408,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -2784,53 +2435,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2844,34 +2499,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2886,65 +2531,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -2958,70 +2609,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3033,29 +2838,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3063,46 +2884,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3112,29 +3007,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3142,75 +3053,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3218,46 +3213,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3266,29 +3333,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3296,46 +3379,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3345,29 +3502,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3375,46 +3548,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3422,29 +3665,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3452,44 +3711,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3498,54 +3754,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3559,160 +3818,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -3720,232 +3969,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -3953,165 +4363,166 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4125,91 +4536,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4223,88 +4628,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4318,407 +4717,462 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4732,341 +5186,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5080,377 +5587,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5458,129 +6250,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5594,200 +6400,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -5795,385 +6757,539 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Updates a certificate operation. - get_certificate.metadata = {'url': "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6181,55 +7297,58 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6243,160 +7362,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6404,115 +7517,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6526,420 +7644,628 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6953,194 +8279,267 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -7148,72 +8547,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -7221,32 +8698,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v2016_10_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_configuration.py index 1a95df0f5541..07502e68f9a8 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_key_vault_client.py index 1ff950f493ad..278870c0c99f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_metadata.json b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_metadata.json index ccc1f8cc1b7d..52a7aea7ec22 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_metadata.json +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,954 +65,1032 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "purge_deleted_storage_account" : { "sync": { - "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "restore_storage_account" : { "sync": { - "signature": "def restore_storage_account(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.StorageRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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\"\"\"" + "signature": "def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: \"_models.StorageRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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, parameters" + "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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, parameters" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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, parameters" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_vendor.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_configuration.py index f6e89c64060a..70a7128f9849 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_key_vault_client.py index 6ea7e93e1c23..30630cac0343 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_key_vault_client_operations.py index d289d2e35470..89d3a02a3479 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,274 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_backup_key_request, build_backup_secret_request, build_backup_storage_account_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_sas_definition_request, build_get_deleted_sas_definitions_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_deleted_storage_account_request, build_get_deleted_storage_accounts_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_purge_deleted_storage_account_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_sas_definition_request, build_recover_deleted_secret_request, build_recover_deleted_storage_account_request, build_regenerate_storage_account_key_request, build_restore_certificate_request, build_restore_key_request, build_restore_secret_request, build_restore_storage_account_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_backup_key_request, + build_backup_secret_request, + build_backup_storage_account_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_sas_definition_request, + build_get_deleted_sas_definitions_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_deleted_storage_account_request, + build_get_deleted_storage_accounts_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_purge_deleted_storage_account_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_sas_definition_request, + build_recover_deleted_secret_request, + build_recover_deleted_storage_account_request, + build_regenerate_storage_account_key_request, + build_restore_certificate_request, + build_restore_key_request, + build_restore_secret_request, + build_restore_storage_account_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +281,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +422,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_key( @@ -239,9 +554,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +564,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +610,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +785,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,53 +812,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -548,33 +876,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -589,64 +908,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -660,69 +986,148 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore - + restore_key.metadata = {"url": "/keys/restore"} # type: ignore - @distributed_trace_async + @overload async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -734,107 +1139,290 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. + :param parameters: The parameters for the encryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyOperationsParameters') - - request = build_encrypt_request( - key_name=key_name, - key_version=key_version, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.encrypt.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('KeyOperationResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore - - @distributed_trace_async - async def decrypt( + @overload + async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": - """Decrypts a single block of encrypted data. + ) -> _models.KeyOperationResult: + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. - 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 + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") + + request = build_encrypt_request( + key_name=key_name, + key_version=key_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. + :param parameters: The parameters for the decryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -842,35 +1430,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def sign( @@ -878,38 +1535,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -917,35 +1590,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def verify( @@ -953,9 +1699,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -964,29 +1710,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -994,35 +1756,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def wrap_key( @@ -1030,9 +1867,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1042,29 +1879,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1072,35 +1925,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def unwrap_key( @@ -1108,9 +2032,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1118,29 +2042,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1148,43 +2088,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1193,55 +2131,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1255,96 +2195,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1352,60 +2285,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1413,190 +2346,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_secret( - self, - vault_base_url: str, - secret_name: str, - parameters: "_models.SecretSetParameters", - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_secret( @@ -1604,38 +2685,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1643,164 +2740,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1814,90 +2914,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1911,87 +3006,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2005,95 +3095,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2101,244 +3186,314 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( @@ -2347,13 +3502,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2362,51 +3517,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2420,336 +3576,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2763,371 +3978,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3135,129 +4645,143 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3271,158 +4795,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3430,38 +5097,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3469,501 +5152,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -3972,7 +5883,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3980,7 +5891,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -3989,51 +5900,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4047,96 +5961,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4144,60 +6053,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4205,114 +6116,120 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4326,87 +6243,84 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4420,95 +6334,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace_async async def get_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any + self, vault_base_url: str, storage_account_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified storage account. @@ -4516,634 +6425,924 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def recover_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace_async async def backup_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.BackupStorageResult": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore + + @overload + async def restore_storage_account( + self, + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + @overload + async def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def restore_storage_account( - self, - vault_base_url: str, - parameters: "_models.StorageRestoreParameters", - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5157,92 +7356,87 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5256,290 +7450,352 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def get_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def recover_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_sas_definition( @@ -5547,35 +7803,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -5583,35 +7855,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_sas_definition( @@ -5619,35 +7954,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -5655,32 +8006,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/__init__.py index 433900a34cfd..6726525a0e5d 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/__init__.py @@ -6,296 +6,208 @@ # 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 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 - 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 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 # 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 ._models_py3 import Action +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 +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 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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, - SasTokenType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._key_vault_client_enums import SasTokenType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupCertificateResult', - 'BackupKeyResult', - 'BackupSecretResult', - 'BackupStorageResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateRestoreParameters', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - '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', - 'KeyVerifyParameters', - 'KeyVerifyResult', - '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', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', - 'SasTokenType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupCertificateResult", + "BackupKeyResult", + "BackupSecretResult", + "BackupStorageResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateRestoreParameters", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "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", + "KeyVerifyParameters", + "KeyVerifyResult", + "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", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", + "SasTokenType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_key_vault_client_enums.py index fc28dcf37707..4904e43a94fb 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,9 +60,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -74,17 +73,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -93,38 +92,40 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -133,14 +134,16 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is not exportable from the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is not exportable from the HSM. RSA_HSM = "RSA-HSM" - #: Not supported in this version. Octet sequence (used to represent symmetric keys). + #: Not supported in this version. Octet sequence (used to represent symmetric keys) OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" @@ -152,9 +155,9 @@ class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCIPHER_ONLY = "encipherOnly" DECIPHER_ONLY = "decipherOnly" -class SasTokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of SAS token the SAS definition will create. - """ + +class SasTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of SAS token the SAS definition will create.""" ACCOUNT = "account" SERVICE = "service" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models.py deleted file mode 100644 index a8b606c71a97..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models.py +++ /dev/null @@ -1,3975 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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(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. - - :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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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_0.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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_0.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_0.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_0.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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_0.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _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}'}, - } - - 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 - - -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. - - 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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _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}, - } - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -class DeletedSasDefinitionItem(SasDefinitionItem): - """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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_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'}, - '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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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_0.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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_0.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.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 - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - 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(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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_0.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_0.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_0.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_0.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_0.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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. - :vartype template_uri: str - :ivar sas_type: Required. 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: Required. The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - 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(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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :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_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: The validity period of SAS tokens created according to the SAS - definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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_0.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.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_0.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(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. - :vartype storage_bundle_backup: bytes - """ - - _validation = { - 'storage_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. - :paramtype storage_bundle_backup: bytes - """ - super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = kwargs['storage_bundle_backup'] - - -class SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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-keys/azure/keyvault/keys/_generated/v7_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models_py3.py index ff95bb20a6a6..1d042e3ec757 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,24 +148,20 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -179,24 +171,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -206,24 +194,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupStorageResult(msrest.serialization.Model): +class BackupStorageResult(_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. @@ -233,20 +217,16 @@ class BackupStorageResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupStorageResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -268,25 +248,25 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -305,11 +285,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -325,55 +305,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -385,28 +365,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -415,22 +395,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. + :ivar base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need to + contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -439,20 +419,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -460,14 +440,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. + :keyword base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need + to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -476,10 +456,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -487,7 +467,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -497,16 +477,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -514,12 +490,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -532,32 +508,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -568,27 +540,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -597,14 +569,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -618,19 +590,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -643,38 +615,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -684,19 +656,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -709,72 +681,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -785,7 +753,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -802,30 +770,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -835,7 +803,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -850,7 +818,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -862,40 +830,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -918,28 +881,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -957,7 +920,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -967,61 +930,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1030,16 +988,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -1051,18 +1009,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -1072,13 +1025,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1090,30 +1043,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1129,12 +1077,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1146,54 +1094,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1208,7 +1156,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1222,25 +1170,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1251,7 +1199,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1259,13 +1207,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1278,27 +1226,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1307,7 +1251,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1315,21 +1259,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1338,10 +1282,10 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1357,7 +1301,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1372,26 +1316,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1401,19 +1345,19 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1422,7 +1366,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1430,21 +1374,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1453,10 +1397,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1472,7 +1416,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1487,26 +1431,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1516,19 +1460,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1541,27 +1485,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -1573,45 +1513,41 @@ class SasDefinitionBundle(msrest.serialization.Model): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _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}, + "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}'}, + "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}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.template_uri = None @@ -1633,15 +1569,15 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1653,48 +1589,43 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): """ _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}, + "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}, } _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'}, + "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"}, } - def __init__( - self, - *, - recovery_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -1705,31 +1636,27 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None @@ -1747,7 +1674,7 @@ class DeletedSasDefinitionItem(SasDefinitionItem): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1759,42 +1686,37 @@ class DeletedSasDefinitionItem(SasDefinitionItem): """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "id": {"readonly": True}, + "secret_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'}, - '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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSasDefinitionListResult(msrest.serialization.Model): +class DeletedSasDefinitionListResult(_serialization.Model): """The deleted SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1807,27 +1729,23 @@ class DeletedSasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1840,7 +1758,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1851,27 +1769,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1884,10 +1802,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1910,7 +1828,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1928,32 +1846,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1967,19 +1885,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1988,7 +1906,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1998,22 +1916,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -2023,12 +1941,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -2045,7 +1963,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -2062,27 +1980,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -2093,7 +2011,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -2101,13 +2019,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2120,27 +2038,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -2151,31 +2065,27 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None @@ -2193,7 +2103,7 @@ class DeletedStorageAccountItem(StorageAccountItem): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2206,42 +2116,37 @@ class DeletedStorageAccountItem(StorageAccountItem): """ _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -2258,37 +2163,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -2315,7 +2216,7 @@ class DeletedStorageBundle(StorageBundle): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2328,48 +2229,43 @@ class DeletedStorageBundle(StorageBundle): """ _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}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedStorageListResult(msrest.serialization.Model): +class DeletedStorageListResult(_serialization.Model): """The deleted storage account list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2382,27 +2278,23 @@ class DeletedStorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedStorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedStorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -2416,30 +2308,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -2453,33 +2341,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -2497,24 +2380,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -2527,7 +2410,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -2535,7 +2418,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -2545,29 +2428,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -2582,9 +2459,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -2606,20 +2483,20 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2643,8 +2520,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2653,29 +2530,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2687,7 +2564,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2696,8 +2573,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2721,15 +2598,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2765,26 +2642,26 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2803,17 +2680,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2821,40 +2698,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2862,13 +2739,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2877,59 +2754,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2942,27 +2819,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2974,117 +2847,107 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -3092,45 +2955,40 @@ def __init__( self.curve = curve -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -3138,37 +2996,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -3176,21 +3028,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3200,16 +3052,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -3219,75 +3071,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3297,24 +3145,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -3324,16 +3168,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -3341,12 +3181,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_0.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -3356,15 +3196,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -3373,12 +3213,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3388,24 +3228,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3419,104 +3255,100 @@ class SasDefinitionAttributes(msrest.serialization.Model): :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", + definition, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar 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. + :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. + Required. :vartype template_uri: str - :ivar sas_type: Required. 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. Required. Known values + are: "account" and "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: Required. 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. Required. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'template_uri': {'required': True}, - 'sas_type': {'required': True}, - 'validity_period': {'required': True}, + "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}'}, + "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: Union[str, "SasTokenType"], + sas_type: Union[str, "_models.SasTokenType"], validity_period: str, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword 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. + :keyword 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. + Required. :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Required. Known values + are: "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. + :keyword validity_period: The validity period of SAS tokens created according to the SAS + definition. Required. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3524,7 +3356,7 @@ def __init__( self.tags = tags -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3537,59 +3369,55 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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: Optional[str] = None, - sas_type: Optional[Union[str, "SasTokenType"]] = None, + sas_type: Optional[Union[str, "_models.SasTokenType"]] = None, validity_period: Optional[str] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3597,18 +3425,18 @@ def __init__( :keyword 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. :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Known values are: + "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType :keyword validity_period: The validity period of SAS tokens created according to the SAS definition. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3634,25 +3462,25 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3671,11 +3499,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3688,27 +3516,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3716,62 +3540,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3780,14 +3594,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3796,48 +3610,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3846,16 +3660,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3869,76 +3683,71 @@ class StorageAccountAttributes(msrest.serialization.Model): :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", + account, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3948,26 +3757,26 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3976,38 +3785,33 @@ def __init__( self.tags = tags -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -4018,16 +3822,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -4036,7 +3840,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -4049,10 +3853,10 @@ def __init__( :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -4060,7 +3864,7 @@ def __init__( self.tags = tags -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -4073,58 +3877,49 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageRestoreParameters(msrest.serialization.Model): +class StorageRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. + :ivar storage_bundle_backup: The backup blob associated with a storage account. Required. :vartype storage_bundle_backup: bytes """ _validation = { - 'storage_bundle_backup': {'required': True}, + "storage_bundle_backup": {"required": True}, } _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, + "storage_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - storage_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, storage_bundle_backup: bytes, **kwargs): """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. + :keyword storage_bundle_backup: The backup blob associated with a storage account. Required. :paramtype storage_bundle_backup: bytes """ - super(StorageRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_bundle_backup = storage_bundle_backup -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -4136,9 +3931,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -4157,13 +3952,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -4176,20 +3971,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -4200,12 +3991,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -4221,15 +4012,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -4237,8 +4028,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -4254,7 +4045,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_key_vault_client_operations.py index 5901a72a5eec..27aee6d86023 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_key_vault_client_operations.py @@ -6,2763 +6,2189 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/backup") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_storage_account_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_storage_account_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_recover_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2770,71 +2196,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2842,67 +2337,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2910,29 +2479,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2940,170 +2525,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3117,34 +2700,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -3152,53 +2727,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3212,34 +2791,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -3254,65 +2823,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -3326,70 +2901,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.KeyBundle: + """Restores a backed up key to a vault. - request = build_restore_key_request( - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.restore_key.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") + + request = build_restore_key_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3401,29 +3130,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3431,46 +3176,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3480,29 +3299,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3510,75 +3345,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3586,46 +3505,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3634,29 +3625,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3664,46 +3671,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3713,29 +3794,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3743,46 +3840,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3790,29 +3957,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3820,44 +4003,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3866,54 +4046,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3927,160 +4110,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -4088,232 +4261,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -4321,166 +4655,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4494,91 +4829,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4592,87 +4921,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4686,361 +5010,416 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -5049,50 +5428,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5106,340 +5487,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5453,377 +5888,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + deserialized = self._deserialize("IssuerBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Creates a new certificate. - delete_certificate_issuer.metadata = {'url': "/certificates/issuers/{issuer-name}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5831,129 +6551,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5967,200 +6701,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -6168,518 +7058,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6687,7 +7797,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -6696,50 +7806,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6753,160 +7866,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6914,115 +8021,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7036,87 +8148,83 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7130,740 +8238,1015 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace def get_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def recover_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace def backup_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. + :param parameters: The parameters to restore the storage account. Required. :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_storage_account( + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7877,93 +9260,86 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7977,331 +9353,404 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -8309,72 +9758,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -8382,32 +9909,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_0/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_configuration.py index 565764479bb8..a260d72442e2 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_key_vault_client.py index ec9462870adf..ecf98c5501a0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_metadata.json b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_metadata.json index e96348013d7d..aa6ce13f2a1a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_metadata.json +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,246 +65,265 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_1.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_1.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_1.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_1.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" }, "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: Any\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_1.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_1.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, maxresults" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_1.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_1.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_1.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_1.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_1.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_1.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeySignParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeySignParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters\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_1.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters\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_1.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters\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_1.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_1.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_1.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_1.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_1.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_1.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_1.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_1.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_vendor.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_configuration.py index 1972b53fa36f..74ea9479506a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_key_vault_client.py index 51c1a20a5b25..278d02d53ecf 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_key_vault_client_operations.py index 52db176e1724..9707a67571fa 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,215 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_create_key_request, build_decrypt_request, build_delete_key_request, build_encrypt_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_import_key_request, build_purge_deleted_key_request, build_recover_deleted_key_request, build_restore_key_request, build_sign_request, build_unwrap_key_request, build_update_key_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_create_key_request, + build_decrypt_request, + build_delete_key_request, + build_encrypt_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_import_key_request, + build_purge_deleted_key_request, + build_recover_deleted_key_request, + build_restore_key_request, + build_sign_request, + build_unwrap_key_request, + build_update_key_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +222,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +363,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -239,9 +495,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +505,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +551,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_1.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +726,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,53 +753,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_1.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -548,33 +817,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -589,64 +849,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -660,69 +927,148 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore - + restore_key.metadata = {"url": "/keys/restore"} # type: ignore - @distributed_trace_async + @overload async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -734,107 +1080,290 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. + :param parameters: The parameters for the encryption operation. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyOperationsParameters') - - request = build_encrypt_request( - key_name=key_name, - key_version=key_version, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.encrypt.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('KeyOperationResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore - - - @distributed_trace_async - async def decrypt( + @overload + async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": - """Decrypts a single block of encrypted data. + ) -> _models.KeyOperationResult: + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. - 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 + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") + + request = build_encrypt_request( + key_name=key_name, + key_version=key_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. + :param parameters: The parameters for the decryption operation. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -842,35 +1371,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -878,38 +1476,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -917,35 +1531,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -953,9 +1640,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -964,29 +1651,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -994,35 +1697,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1030,9 +1808,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1042,29 +1820,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1072,35 +1866,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1108,9 +1973,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1118,29 +1983,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1148,43 +2029,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1193,55 +2072,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_1.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1255,96 +2136,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1352,60 +2226,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1413,53 +2287,58 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/__init__.py index 48eb2c16009f..1a5572849668 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/__init__.py @@ -6,89 +6,68 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupKeyResult - from ._models_py3 import DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import Error - 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupKeyResult # type: ignore - from ._models import DeletedKeyBundle # type: ignore - from ._models import DeletedKeyItem # type: ignore - from ._models import DeletedKeyListResult # type: ignore - from ._models import Error # 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_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import Error +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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult -from ._key_vault_client_enums import ( - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, -) +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupKeyResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'Error', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', + "Attributes", + "BackupKeyResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "Error", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyRestoreParameters", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_key_vault_client_enums.py index 9c9a63025960..89eee1f06c97 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_key_vault_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -20,22 +19,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -54,9 +53,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -67,17 +66,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -85,40 +84,42 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VERIFY = "verify" WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" - IMPORT_ENUM = "import" + IMPORT = "import" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -127,9 +128,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is not exportable from the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is not exportable from the HSM. RSA_HSM = "RSA-HSM" - #: Not supported in this version. Octet sequence (used to represent symmetric keys). + #: Not supported in this version. Octet sequence (used to represent symmetric keys) OCT = "oct" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models.py deleted file mode 100644 index a1c30dcfeee2..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models.py +++ /dev/null @@ -1,1023 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, 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_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 JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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". - :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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". - :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Not supported in this version. Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype 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 - ): - """ - :keyword exportable: Not supported in this version. Indicates if the private key can be - exported. - :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - 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(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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_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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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 diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models_py3.py index 1a850c51473c..b13dc53cd71a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): +class Attributes(_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. @@ -33,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -61,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -69,7 +71,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -79,24 +81,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -105,7 +103,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -113,21 +111,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -136,10 +134,10 @@ def __init__( :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -155,7 +153,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -170,26 +168,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -199,19 +197,19 @@ def __init__( :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -220,7 +218,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -228,21 +226,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -251,10 +249,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -270,7 +268,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -285,26 +283,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -314,19 +312,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -339,27 +337,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -373,37 +367,33 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -427,8 +417,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -437,29 +427,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -471,7 +461,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -480,8 +470,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -505,15 +495,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -552,28 +542,28 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -592,18 +582,18 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -611,40 +601,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -652,13 +642,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -667,59 +657,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -732,27 +722,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -764,118 +750,108 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Not supported in this version. Indicates if the private key can be exported. :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype 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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Not supported in this version. Indicates if the private key can be exported. :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -883,45 +859,40 @@ def __init__( self.curve = curve -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -929,37 +900,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -967,21 +932,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -991,16 +956,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1010,75 +975,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1088,18 +1049,14 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_key_vault_client_operations.py index f7cc8d7066d4..01cfc5925d53 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_key_vault_client_operations.py @@ -6,778 +6,681 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -785,71 +688,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -857,67 +829,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -925,29 +971,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -955,170 +1017,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_1.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1132,34 +1192,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1167,53 +1219,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_1.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1227,34 +1283,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -1269,65 +1315,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore - + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -1341,70 +1393,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.KeyBundle: + """Restores a backed up key to a vault. - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + 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. - request = build_restore_key_request( - api_version=api_version, - content_type=content_type, + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") + + request = build_restore_key_request( + api_version=api_version, + content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1416,29 +1622,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -1446,46 +1668,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -1495,29 +1791,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -1525,75 +1837,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -1601,46 +1997,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -1649,29 +2117,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -1679,46 +2163,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1728,29 +2286,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1758,46 +2332,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_1.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1805,29 +2449,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1835,44 +2495,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -1881,54 +2538,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_1.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1942,160 +2602,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -2103,53 +2753,58 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_1/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_configuration.py index 457e46a57cde..77b5afbd7fa5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_key_vault_client.py index 9fb22163b5ae..6981c3324ac4 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_metadata.json b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_metadata.json index e02966ad6534..b6d2e48cf1f0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_metadata.json +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,246 +65,265 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_2.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_2.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_2.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_2.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" }, "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: Any\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_2.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_2.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, maxresults" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_2.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_2.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_2.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_2.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_2.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_2.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeySignParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeySignParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters\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_2.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters\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_2.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters\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_2.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_2.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_2.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_2.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_2.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_2.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_2.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_2.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_vendor.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py index d7d9c414df27..3f6fb536e7ae 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_key_vault_client.py index 2c20b19a9f0e..65170dfb8756 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_key_vault_client_operations.py index 5292ff277d47..359a73969ada 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,215 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_create_key_request, build_decrypt_request, build_delete_key_request, build_encrypt_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_import_key_request, build_purge_deleted_key_request, build_recover_deleted_key_request, build_restore_key_request, build_sign_request, build_unwrap_key_request, build_update_key_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_create_key_request, + build_decrypt_request, + build_delete_key_request, + build_encrypt_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_import_key_request, + build_purge_deleted_key_request, + build_recover_deleted_key_request, + build_restore_key_request, + build_sign_request, + build_unwrap_key_request, + build_update_key_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +222,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +363,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -239,9 +495,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +505,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +551,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_2.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +726,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,53 +753,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_2.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -548,33 +817,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -589,64 +849,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -660,69 +927,148 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore - + restore_key.metadata = {"url": "/keys/restore"} # type: ignore - @distributed_trace_async + @overload async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -734,107 +1080,290 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. + :param parameters: The parameters for the encryption operation. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyOperationsParameters') - - request = build_encrypt_request( - key_name=key_name, - key_version=key_version, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.encrypt.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('KeyOperationResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore - - - @distributed_trace_async - async def decrypt( + @overload + async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": - """Decrypts a single block of encrypted data. + ) -> _models.KeyOperationResult: + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. - 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 + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") + + request = build_encrypt_request( + key_name=key_name, + key_version=key_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. + :param parameters: The parameters for the decryption operation. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -842,35 +1371,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -878,38 +1476,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -917,35 +1531,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -953,9 +1640,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -964,29 +1651,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -994,35 +1697,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1030,9 +1808,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1042,29 +1820,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1072,35 +1866,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1108,9 +1973,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1118,29 +1983,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1148,43 +2029,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1193,55 +2072,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_2.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1255,96 +2136,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1352,60 +2226,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1413,53 +2287,58 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/__init__.py index 48eb2c16009f..1a5572849668 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/__init__.py @@ -6,89 +6,68 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupKeyResult - from ._models_py3 import DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import Error - 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupKeyResult # type: ignore - from ._models import DeletedKeyBundle # type: ignore - from ._models import DeletedKeyItem # type: ignore - from ._models import DeletedKeyListResult # type: ignore - from ._models import Error # 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_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import Error +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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult -from ._key_vault_client_enums import ( - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, -) +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupKeyResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'Error', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', + "Attributes", + "BackupKeyResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "Error", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyRestoreParameters", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_key_vault_client_enums.py index 76640ff27b34..b2173ca5f18e 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_key_vault_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -20,22 +19,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -54,9 +53,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -67,9 +66,9 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" @@ -87,9 +86,9 @@ class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, A192_CBCPAD = "A192CBCPAD" A256_CBCPAD = "A256CBCPAD" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -97,40 +96,42 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VERIFY = "verify" WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" - IMPORT_ENUM = "import" + IMPORT = "import" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -139,11 +140,11 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is not exportable from the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is not exportable from the HSM. RSA_HSM = "RSA-HSM" - #: Octet sequence (used to represent symmetric keys). + #: Octet sequence (used to represent symmetric keys) OCT = "oct" #: Octet sequence (used to represent symmetric keys) which is not exportable from the HSM. OCT_HSM = "oct-HSM" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models.py deleted file mode 100644 index 53e36e63e684..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models.py +++ /dev/null @@ -1,1067 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_2.models.DeletedKeyItem] - :ivar next_link: The URL to get the next set of deleted keys. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, 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 JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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", "oct-HSM". - :vartype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: Protected Key, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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", "oct-HSM". - :paramtype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: Protected Key, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". - :vartype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar public_exponent: The public exponent for a RSA key. - :vartype public_exponent: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'public_exponent': {'key': 'public_exponent', '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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". - :paramtype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword public_exponent: The public exponent for a RSA key. - :paramtype public_exponent: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kwargs['kty'] - self.key_size = kwargs.get('key_size', None) - self.public_exponent = kwargs.get('public_exponent', 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(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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_2.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(msrest.serialization.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 - :ivar iv: - :vartype iv: bytes - :ivar authentication_tag: - :vartype authentication_tag: bytes - :ivar additional_authenticated_data: - :vartype additional_authenticated_data: bytes - """ - - _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - 'iv': {'readonly': True}, - 'authentication_tag': {'readonly': True}, - 'additional_authenticated_data': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'authentication_tag': {'key': 'tag', 'type': 'base64'}, - 'additional_authenticated_data': {'key': 'aad', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) - self.kid = None - self.result = None - self.iv = None - self.authentication_tag = None - self.additional_authenticated_data = None - - -class KeyOperationsParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". - :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - :ivar iv: Initialization vector for symmetric algorithms. - :vartype iv: bytes - :ivar aad: Additional data to authenticate but not encrypt/decrypt when using authenticated - crypto algorithms. - :vartype aad: bytes - :ivar tag: The tag to authenticate when performing decryption with an authenticated algorithm. - :vartype tag: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'aad': {'key': 'aad', 'type': 'base64'}, - 'tag': {'key': 'tag', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". - :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - :keyword iv: Initialization vector for symmetric algorithms. - :paramtype iv: bytes - :keyword aad: Additional data to authenticate but not encrypt/decrypt when using authenticated - crypto algorithms. - :paramtype aad: bytes - :keyword tag: The tag to authenticate when performing decryption with an authenticated - algorithm. - :paramtype tag: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - self.iv = kwargs.get('iv', None) - self.aad = kwargs.get('aad', None) - self.tag = kwargs.get('tag', None) - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Not supported in this version. Indicates if the private key can be exported. - :vartype exportable: bool - :ivar 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". - :vartype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype 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 - ): - """ - :keyword exportable: Not supported in this version. Indicates if the private key can be - exported. - :paramtype exportable: bool - :keyword 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". - :paramtype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName - """ - 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(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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 diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models_py3.py index 5818da52913a..bc47cb6102d8 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): +class Attributes(_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. @@ -33,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -61,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -69,7 +71,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -79,24 +81,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -105,7 +103,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -113,21 +111,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -136,10 +134,10 @@ def __init__( :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -155,7 +153,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -170,26 +168,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -199,19 +197,19 @@ def __init__( :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -220,7 +218,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -228,21 +226,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -251,10 +249,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -270,7 +268,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -285,26 +283,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -314,19 +312,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -339,27 +337,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -373,37 +367,33 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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", "oct-HSM". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -427,8 +417,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: Protected Key, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -437,29 +427,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -471,7 +461,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -480,8 +470,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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", "oct-HSM". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -505,15 +495,15 @@ def __init__( :paramtype k: bytes :keyword t: Protected Key, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -552,28 +542,28 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -592,18 +582,18 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -613,42 +603,42 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'public_exponent': {'key': 'public_exponent', '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'}, + "kty": {"key": "kty", "type": "str"}, + "key_size": {"key": "key_size", "type": "int"}, + "public_exponent": {"key": "public_exponent", "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, public_exponent: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype kty: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -658,13 +648,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.public_exponent = public_exponent @@ -674,59 +664,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_2.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_2.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -739,27 +729,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -777,28 +763,24 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - 'iv': {'readonly': True}, - 'authentication_tag': {'readonly': True}, - 'additional_authenticated_data': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, + "iv": {"readonly": True}, + "authentication_tag": {"readonly": True}, + "additional_authenticated_data": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'authentication_tag': {'key': 'tag', 'type': 'base64'}, - 'additional_authenticated_data': {'key': 'aad', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, + "iv": {"key": "iv", "type": "base64"}, + "authentication_tag": {"key": "tag", "type": "base64"}, + "additional_authenticated_data": {"key": "aad", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None self.iv = None @@ -806,14 +788,14 @@ def __init__( self.additional_authenticated_data = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", "A128CBC", "A192CBC", + "A256CBC", "A128CBCPAD", "A192CBCPAD", and "A256CBCPAD". :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes @@ -827,22 +809,22 @@ class KeyOperationsParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'aad': {'key': 'aad', 'type': 'base64'}, - 'tag': {'key': 'tag', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, + "iv": {"key": "iv", "type": "base64"}, + "aad": {"key": "aad", "type": "base64"}, + "tag": {"key": "tag", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, iv: Optional[bytes] = None, aad: Optional[bytes] = None, @@ -850,9 +832,9 @@ def __init__( **kwargs ): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". + "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", and "A256CBCPAD". :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes @@ -865,7 +847,7 @@ def __init__( algorithm. :paramtype tag: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value self.iv = iv @@ -873,57 +855,57 @@ def __init__( self.tag = tag -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Not supported in this version. Indicates if the private key can be exported. :vartype exportable: bool - :ivar 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". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype 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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Not supported in this version. Indicates if the private key can be exported. :paramtype exportable: bool - :keyword 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". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -931,45 +913,40 @@ def __init__( self.curve = curve -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -977,37 +954,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -1015,21 +986,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1039,16 +1010,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_2.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_2.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1058,75 +1029,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_2.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1136,18 +1103,14 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_key_vault_client_operations.py index da93f8832c2e..d1026d84e236 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_key_vault_client_operations.py @@ -6,778 +6,681 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -785,71 +688,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -857,67 +829,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -925,29 +971,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -955,170 +1017,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_2.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1132,34 +1192,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1167,53 +1219,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_2.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1227,34 +1283,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -1269,65 +1315,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore - + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -1341,70 +1393,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.KeyBundle: + """Restores a backed up key to a vault. - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + 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. - request = build_restore_key_request( - api_version=api_version, - content_type=content_type, + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_2.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") + + request = build_restore_key_request( + api_version=api_version, + content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1416,29 +1622,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -1446,46 +1668,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -1495,29 +1791,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -1525,75 +1837,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -1601,46 +1997,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -1649,29 +2117,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -1679,46 +2163,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1728,29 +2286,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1758,46 +2332,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_2.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1805,29 +2449,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1835,44 +2495,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -1881,54 +2538,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_2.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1942,160 +2602,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -2103,53 +2753,58 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_configuration.py index 628918574705..801ab6cd733d 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_key_vault_client.py index 0c65a11683de..5f9d522cc23a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_metadata.json b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_metadata.json index 3bcf4a84f89f..c0b04226f052 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_metadata.json +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,306 +65,330 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "rotate_key" : { "sync": { - "signature": "def rotate_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Creates a new key version, stores it, then returns key parameters, attributes and policy to the\nclient.\n\nThe operation will rotate the key based on the key policy. It requires the keys/rotate\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 key to be rotated. The system will generate a new version in the\n specified 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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def rotate_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Creates a new key version, stores it, then returns key parameters, attributes and policy to the\nclient.\n\nThe operation will rotate the key based on the key policy. It requires the keys/rotate\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of key to be rotated. The system will generate a new version in the\n specified key. Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def rotate_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Creates a new key version, stores it, then returns key parameters, attributes and policy to the\nclient.\n\nThe operation will rotate the key based on the key policy. It requires the keys/rotate\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 key to be rotated. The system will generate a new version in the\n specified 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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def rotate_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Creates a new key version, stores it, then returns key parameters, attributes and policy to the\nclient.\n\nThe operation will rotate the key based on the key policy. It requires the keys/rotate\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of key to be rotated. The system will generate a new version in the\n specified key. Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_3.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_3.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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_3.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" }, "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: Any\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_3.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_3.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, maxresults" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_3.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_3.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_3.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_3.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_3.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_3.models.BackupKeyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeySignParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeySignParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters\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_3.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters\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_3.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyVerifyResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters\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_3.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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_3.models.KeyOperationResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "release" : { "sync": { - "signature": "def release(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyReleaseParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyReleaseResult\"\n", - "doc": "\"\"\"Releases a key.\n\nThe release key operation is applicable to all key types. The target key must be marked\nexportable. This operation requires the keys/release permission.\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:param parameters: The parameters for the key release operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyReleaseResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def release(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyReleaseParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyReleaseResult:\n", + "doc": "\"\"\"Releases a key.\n\nThe release key operation is applicable to all key types. The target key must be marked\nexportable. This operation requires the keys/release permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\n:type key_version: str\n:param parameters: The parameters for the key release operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyReleaseResult or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def release(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyReleaseParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyReleaseResult\":\n", - "doc": "\"\"\"Releases a key.\n\nThe release key operation is applicable to all key types. The target key must be marked\nexportable. This operation requires the keys/release permission.\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:param parameters: The parameters for the key release operation.\n:type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyReleaseResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_version, parameters" + "signature": "async def release(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyReleaseParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyReleaseResult:\n", + "doc": "\"\"\"Releases a key.\n\nThe release key operation is applicable to all key types. The target key must be marked\nexportable. This operation requires the keys/release permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\n:type key_version: str\n:param parameters: The parameters for the key release operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyReleaseResult or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_version, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_3.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_3.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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_3.models.DeletedKeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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_3.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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_3.models.KeyBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "get_key_rotation_policy" : { "sync": { - "signature": "def get_key_rotation_policy(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyRotationPolicy\"\n", - "doc": "\"\"\"Lists the policy for a key.\n\nThe GetKeyRotationPolicy operation returns the specified key policy resources in the specified\nkey vault. 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 in a given key vault.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e _models.KeyRotationPolicy:\n", + "doc": "\"\"\"Lists the policy for a key.\n\nThe GetKeyRotationPolicy operation returns the specified key policy resources in the specified\nkey vault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key in a given key vault. Required.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e \"_models.KeyRotationPolicy\":\n", - "doc": "\"\"\"Lists the policy for a key.\n\nThe GetKeyRotationPolicy operation returns the specified key policy resources in the specified\nkey vault. 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 in a given key vault.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name" + "signature": "async def get_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\n) -\u003e _models.KeyRotationPolicy:\n", + "doc": "\"\"\"Lists the policy for a key.\n\nThe GetKeyRotationPolicy operation returns the specified key policy resources in the specified\nkey vault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key in a given key vault. Required.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, **kwargs" + } }, "update_key_rotation_policy" : { "sync": { - "signature": "def update_key_rotation_policy(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_rotation_policy, # type: \"_models.KeyRotationPolicy\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyRotationPolicy\"\n", - "doc": "\"\"\"Updates the rotation policy for a key.\n\nSet specified members in the key policy. Leave others as undefined. 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 the key in the given vault.\n:type key_name: str\n:param key_rotation_policy: The policy for the key.\n:type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n key_rotation_policy: Union[_models.KeyRotationPolicy, IO],\n **kwargs: Any\n) -\u003e _models.KeyRotationPolicy:\n", + "doc": "\"\"\"Updates the rotation policy for a key.\n\nSet specified members in the key policy. Leave others as undefined. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key in the given vault. Required.\n:type key_name: str\n:param key_rotation_policy: The policy for the key. Is either a model type or a IO type.\n Required.\n:type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_rotation_policy, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n key_rotation_policy: \"_models.KeyRotationPolicy\",\n **kwargs: Any\n) -\u003e \"_models.KeyRotationPolicy\":\n", - "doc": "\"\"\"Updates the rotation policy for a key.\n\nSet specified members in the key policy. Leave others as undefined. 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 the key in the given vault.\n:type key_name: str\n:param key_rotation_policy: The policy for the key.\n:type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, key_name, key_rotation_policy" + "signature": "async def update_key_rotation_policy(\n self,\n vault_base_url: str,\n key_name: str,\n key_rotation_policy: Union[_models.KeyRotationPolicy, IO],\n **kwargs: Any\n) -\u003e _models.KeyRotationPolicy:\n", + "doc": "\"\"\"Updates the rotation policy for a key.\n\nSet specified members in the key policy. Leave others as undefined. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param key_name: The name of the key in the given vault. Required.\n:type key_name: str\n:param key_rotation_policy: The policy for the key. Is either a model type or a IO type.\n Required.\n:type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyRotationPolicy or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, key_rotation_policy, **kwargs" + } }, "get_random_bytes" : { "sync": { - "signature": "def get_random_bytes(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.GetRandomBytesRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.RandomBytes\"\n", - "doc": "\"\"\"Get the requested number of bytes containing random values.\n\nGet the requested number of bytes containing random values from a managed HSM.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param parameters: The request object to get random bytes.\n:type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RandomBytes, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RandomBytes\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_random_bytes(\n self,\n vault_base_url: str,\n parameters: Union[_models.GetRandomBytesRequest, IO],\n **kwargs: Any\n) -\u003e _models.RandomBytes:\n", + "doc": "\"\"\"Get the requested number of bytes containing random values.\n\nGet the requested number of bytes containing random values from a managed HSM.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param parameters: The request object to get random bytes. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RandomBytes or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RandomBytes\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_random_bytes(\n self,\n vault_base_url: str,\n parameters: \"_models.GetRandomBytesRequest\",\n **kwargs: Any\n) -\u003e \"_models.RandomBytes\":\n", - "doc": "\"\"\"Get the requested number of bytes containing random values.\n\nGet the requested number of bytes containing random values from a managed HSM.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param parameters: The request object to get random bytes.\n:type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RandomBytes, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RandomBytes\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def get_random_bytes(\n self,\n vault_base_url: str,\n parameters: Union[_models.GetRandomBytesRequest, IO],\n **kwargs: Any\n) -\u003e _models.RandomBytes:\n", + "doc": "\"\"\"Get the requested number of bytes containing random values.\n\nGet the requested number of bytes containing random values from a managed HSM.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required.\n:type vault_base_url: str\n:param parameters: The request object to get random bytes. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: RandomBytes or the result of cls(response)\n:rtype: ~azure.keyvault.v7_3.models.RandomBytes\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_vendor.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_configuration.py index ebf0c448e109..d86cc427064c 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_key_vault_client.py index b4ee0991744f..a073964e9bdb 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_vendor.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_key_vault_client_operations.py index 8d0a4c64c953..abf076f84879 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_key_vault_client_operations.py @@ -6,169 +6,285 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_create_key_request, build_decrypt_request, build_delete_key_request, build_encrypt_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_key_request, build_get_key_rotation_policy_request, build_get_key_versions_request, build_get_keys_request, build_get_random_bytes_request, build_import_key_request, build_purge_deleted_key_request, build_recover_deleted_key_request, build_release_request, build_restore_key_request, build_rotate_key_request, build_sign_request, build_unwrap_key_request, build_update_key_request, build_update_key_rotation_policy_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_create_key_request, + build_decrypt_request, + build_delete_key_request, + build_encrypt_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_key_request, + build_get_key_rotation_policy_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_random_bytes_request, + build_import_key_request, + build_purge_deleted_key_request, + build_recover_deleted_key_request, + build_release_request, + build_restore_key_request, + build_rotate_key_request, + build_sign_request, + build_unwrap_key_request, + build_update_key_request, + build_update_key_rotation_policy_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore @distributed_trace_async - async def rotate_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def rotate_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _models.KeyBundle: """Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param key_name: The name of key to be rotated. The system will generate a new version in the - specified key. + specified key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_rotate_key_request( key_name=key_name, api_version=api_version, - template_url=self.rotate_key.metadata['url'], + template_url=self.rotate_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - rotate_key.metadata = {'url': "/keys/{key-name}/rotate"} # type: ignore + rotate_key.metadata = {"url": "/keys/{key-name}/rotate"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -176,70 +292,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -247,56 +433,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -304,9 +565,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -314,29 +575,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -344,168 +621,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -519,33 +796,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -553,53 +823,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -613,33 +887,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -654,64 +919,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore - + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -725,59 +997,214 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def encrypt( @@ -785,9 +1212,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -799,29 +1226,45 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -829,35 +1272,110 @@ async def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def decrypt( @@ -865,9 +1383,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -877,29 +1395,45 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -907,35 +1441,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -943,38 +1546,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -982,35 +1601,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -1018,9 +1710,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -1029,29 +1721,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -1059,35 +1767,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1095,9 +1878,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1107,29 +1890,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1137,35 +1936,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1173,9 +2043,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1183,29 +2053,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1213,35 +2099,104 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore + + @overload + async def release( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyReleaseParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyReleaseResult: + """Releases a key. + + The release key operation is applicable to all key types. The target key must be marked + exportable. This operation requires the keys/release permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to get. Required. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. + :type key_version: str + :param parameters: The parameters for the key release operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def release( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyReleaseResult: + """Releases a key. + + The release key operation is applicable to all key types. The target key must be marked + exportable. This operation requires the keys/release permission. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to get. Required. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. + :type key_version: str + :param parameters: The parameters for the key release operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def release( @@ -1249,37 +2204,54 @@ async def release( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyReleaseParameters", + parameters: Union[_models.KeyReleaseParameters, IO], **kwargs: Any - ) -> "_models.KeyReleaseResult": + ) -> _models.KeyReleaseResult: """Releases a key. The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :type key_version: str - :param parameters: The parameters for the key release operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters + :param parameters: The parameters for the key release operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyReleaseResult, or the result of cls(response) + :return: KeyReleaseResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyReleaseResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyReleaseResult] - _json = self._serialize.body(parameters, 'KeyReleaseParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyReleaseParameters") request = build_release_request( key_name=key_name, @@ -1287,43 +2259,41 @@ async def release( api_version=api_version, content_type=content_type, json=_json, - template_url=self.release.metadata['url'], + content=_content, + template_url=self.release.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyReleaseResult', pipeline_response) + deserialized = self._deserialize("KeyReleaseResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - release.metadata = {'url': "/keys/{key-name}/{key-version}/release"} # type: ignore - + release.metadata = {"url": "/keys/{key-name}/{key-version}/release"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1332,55 +2302,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_3.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1394,96 +2366,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1491,60 +2456,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1552,251 +2517,396 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore @distributed_trace_async async def get_key_rotation_policy( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyRotationPolicy": + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> _models.KeyRotationPolicy: """Lists the policy for a key. The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key 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. Required. :type vault_base_url: str - :param key_name: The name of the key in a given key vault. + :param key_name: The name of the key in a given key vault. Required. :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyRotationPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyRotationPolicy] - request = build_get_key_rotation_policy_request( key_name=key_name, api_version=api_version, - template_url=self.get_key_rotation_policy.metadata['url'], + template_url=self.get_key_rotation_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyRotationPolicy', pipeline_response) + deserialized = self._deserialize("KeyRotationPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key_rotation_policy.metadata = {'url': "/keys/{key-name}/rotationpolicy"} # type: ignore + get_key_rotation_policy.metadata = {"url": "/keys/{key-name}/rotationpolicy"} # type: ignore + + @overload + async def update_key_rotation_policy( + self, + vault_base_url: str, + key_name: str, + key_rotation_policy: _models.KeyRotationPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyRotationPolicy: + """Updates the rotation policy for a key. + + Set specified members in the key policy. Leave others as undefined. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key in the given vault. Required. + :type key_name: str + :param key_rotation_policy: The policy for the key. Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key_rotation_policy( + self, + vault_base_url: str, + key_name: str, + key_rotation_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyRotationPolicy: + """Updates the rotation policy for a key. + + Set specified members in the key policy. Leave others as undefined. This operation requires the + keys/update permission. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key in the given vault. Required. + :type key_name: str + :param key_rotation_policy: The policy for the key. Required. + :type key_rotation_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key_rotation_policy( self, vault_base_url: str, key_name: str, - key_rotation_policy: "_models.KeyRotationPolicy", + key_rotation_policy: Union[_models.KeyRotationPolicy, IO], **kwargs: Any - ) -> "_models.KeyRotationPolicy": + ) -> _models.KeyRotationPolicy: """Updates the rotation policy for a key. Set specified members in the key policy. Leave others as undefined. This operation requires the keys/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. Required. :type vault_base_url: str - :param key_name: The name of the key in the given vault. + :param key_name: The name of the key in the given vault. Required. :type key_name: str - :param key_rotation_policy: The policy for the key. - :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :param key_rotation_policy: The policy for the key. Is either a model type or a IO type. + Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyRotationPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(key_rotation_policy, 'KeyRotationPolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyRotationPolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_rotation_policy, (IO, bytes)): + _content = key_rotation_policy + else: + _json = self._serialize.body(key_rotation_policy, "KeyRotationPolicy") request = build_update_key_rotation_policy_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key_rotation_policy.metadata['url'], + content=_content, + template_url=self.update_key_rotation_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyRotationPolicy', pipeline_response) + deserialized = self._deserialize("KeyRotationPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key_rotation_policy.metadata = {'url': "/keys/{key-name}/rotationpolicy"} # type: ignore + update_key_rotation_policy.metadata = {"url": "/keys/{key-name}/rotationpolicy"} # type: ignore - - @distributed_trace_async + @overload async def get_random_bytes( self, vault_base_url: str, - parameters: "_models.GetRandomBytesRequest", + parameters: _models.GetRandomBytesRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.RandomBytes": + ) -> _models.RandomBytes: """Get the requested number of bytes containing random values. Get the requested number of bytes containing random values from a managed HSM. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The request object to get random bytes. + :param parameters: The request object to get random bytes. Required. :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RandomBytes or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RandomBytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_random_bytes( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RandomBytes: + """Get the requested number of bytes containing random values. + + Get the requested number of bytes containing random values from a managed HSM. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The request object to get random bytes. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RandomBytes or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RandomBytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_random_bytes( + self, vault_base_url: str, parameters: Union[_models.GetRandomBytesRequest, IO], **kwargs: Any + ) -> _models.RandomBytes: + """Get the requested number of bytes containing random values. + + Get the requested number of bytes containing random values from a managed HSM. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The request object to get random bytes. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RandomBytes, or the result of cls(response) + :return: RandomBytes or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RandomBytes - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RandomBytes"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RandomBytes] - _json = self._serialize.body(parameters, 'GetRandomBytesRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GetRandomBytesRequest") request = build_get_random_bytes_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get_random_bytes.metadata['url'], + content=_content, + template_url=self.get_random_bytes.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RandomBytes', pipeline_response) + deserialized = self._deserialize("RandomBytes", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_random_bytes.metadata = {'url': "/rng"} # type: ignore - + get_random_bytes.metadata = {"url": "/rng"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/__init__.py index 7162d3197cfb..afef49cb6d7f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/__init__.py @@ -6,126 +6,94 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupKeyResult - from ._models_py3 import DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import Error - from ._models_py3 import GetRandomBytesRequest - from ._models_py3 import JsonWebKey - from ._models_py3 import KeyAttributes - from ._models_py3 import KeyBundle - from ._models_py3 import KeyCreateParameters - from ._models_py3 import KeyExportParameters - 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 KeyReleaseParameters - from ._models_py3 import KeyReleasePolicy - from ._models_py3 import KeyReleaseResult - from ._models_py3 import KeyRestoreParameters - from ._models_py3 import KeyRotationPolicy - from ._models_py3 import KeyRotationPolicyAttributes - from ._models_py3 import KeySignParameters - from ._models_py3 import KeyUpdateParameters - from ._models_py3 import KeyVaultError - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - from ._models_py3 import LifetimeActions - from ._models_py3 import LifetimeActionsTrigger - from ._models_py3 import LifetimeActionsType - from ._models_py3 import RandomBytes -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupKeyResult # type: ignore - from ._models import DeletedKeyBundle # type: ignore - from ._models import DeletedKeyItem # type: ignore - from ._models import DeletedKeyListResult # type: ignore - from ._models import Error # type: ignore - from ._models import GetRandomBytesRequest # 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 KeyExportParameters # 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 KeyReleaseParameters # type: ignore - from ._models import KeyReleasePolicy # type: ignore - from ._models import KeyReleaseResult # type: ignore - from ._models import KeyRestoreParameters # type: ignore - from ._models import KeyRotationPolicy # type: ignore - from ._models import KeyRotationPolicyAttributes # 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 LifetimeActions # type: ignore - from ._models import LifetimeActionsTrigger # type: ignore - from ._models import LifetimeActionsType # type: ignore - from ._models import RandomBytes # type: ignore +from ._models_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import Error +from ._models_py3 import GetRandomBytesRequest +from ._models_py3 import JsonWebKey +from ._models_py3 import KeyAttributes +from ._models_py3 import KeyBundle +from ._models_py3 import KeyCreateParameters +from ._models_py3 import KeyExportParameters +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 KeyReleaseParameters +from ._models_py3 import KeyReleasePolicy +from ._models_py3 import KeyReleaseResult +from ._models_py3 import KeyRestoreParameters +from ._models_py3 import KeyRotationPolicy +from ._models_py3 import KeyRotationPolicyAttributes +from ._models_py3 import KeySignParameters +from ._models_py3 import KeyUpdateParameters +from ._models_py3 import KeyVaultError +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +from ._models_py3 import LifetimeActions +from ._models_py3 import LifetimeActionsTrigger +from ._models_py3 import LifetimeActionsType +from ._models_py3 import RandomBytes -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyEncryptionAlgorithm, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyEncryptionAlgorithm +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupKeyResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'Error', - 'GetRandomBytesRequest', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyExportParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyReleaseParameters', - 'KeyReleasePolicy', - 'KeyReleaseResult', - 'KeyRestoreParameters', - 'KeyRotationPolicy', - 'KeyRotationPolicyAttributes', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'LifetimeActions', - 'LifetimeActionsTrigger', - 'LifetimeActionsType', - 'RandomBytes', - 'ActionType', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyEncryptionAlgorithm', + "Attributes", + "BackupKeyResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "Error", + "GetRandomBytesRequest", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyExportParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyReleaseParameters", + "KeyReleasePolicy", + "KeyReleaseResult", + "KeyRestoreParameters", + "KeyRotationPolicy", + "KeyRotationPolicyAttributes", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "LifetimeActions", + "LifetimeActionsTrigger", + "LifetimeActionsType", + "RandomBytes", + "ActionType", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyEncryptionAlgorithm", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_key_vault_client_enums.py index 4a822b5206c2..5874e40f2ae4 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_key_vault_client_enums.py @@ -7,13 +7,11 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" #: Rotate the key based on the key policy. ROTATE = "rotate" @@ -21,7 +19,8 @@ class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: default to 30 days before expiry. NOTIFY = "notify" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -30,22 +29,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -64,9 +63,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -77,9 +76,9 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" @@ -97,9 +96,9 @@ class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, A192_CBCPAD = "A192CBCPAD" A256_CBCPAD = "A256CBCPAD" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -107,41 +106,43 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VERIFY = "verify" WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" - IMPORT_ENUM = "import" + IMPORT = "import" EXPORT = "export" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -150,18 +151,18 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is stored in the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is stored in the HSM. RSA_HSM = "RSA-HSM" - #: Octet sequence (used to represent symmetric keys). + #: Octet sequence (used to represent symmetric keys) OCT = "oct" #: Octet sequence (used to represent symmetric keys) which is stored the HSM. OCT_HSM = "oct-HSM" -class KeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The encryption algorithm to use to protected the exported key material - """ + +class KeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The encryption algorithm to use to protected the exported key material.""" CKM_RSA_AES_KEY_WRAP = "CKM_RSA_AES_KEY_WRAP" RSA_AES_KEY_WRAP256 = "RSA_AES_KEY_WRAP_256" diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models.py deleted file mode 100644 index a332d5fa9dd4..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models.py +++ /dev/null @@ -1,1479 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 release_policy: The policy rules under which the key can be exported. - :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword release_policy: The policy rules under which the key can be exported. - :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - 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 - self.release_policy = kwargs.get('release_policy', None) - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 release_policy: The policy rules under which the key can be exported. - :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - '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 - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword release_policy: The policy rules under which the key can be exported. - :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_3.models.DeletedKeyItem] - :ivar next_link: The URL to get the next set of deleted keys. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, 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_3.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 GetRandomBytesRequest(msrest.serialization.Model): - """The get random bytes request object. - - All required parameters must be populated in order to send to Azure. - - :ivar count: Required. The requested number of random bytes. - :vartype count: int - """ - - _validation = { - 'count': {'required': True, 'maximum': 128, 'minimum': 1}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword count: Required. The requested number of random bytes. - :paramtype count: int - """ - super(GetRandomBytesRequest, self).__init__(**kwargs) - self.count = kwargs['count'] - - -class JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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", "oct-HSM". - :vartype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: Protected Key, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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", "oct-HSM". - :paramtype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: Protected Key, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_3.models.DeletionRecoveryLevel - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - """ - - _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'}, - 'exportable': {'key': 'exportable', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - self.exportable = kwargs.get('exportable', None) - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". - :vartype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar public_exponent: The public exponent for a RSA key. - :vartype public_exponent: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - :ivar release_policy: The policy rules under which the key can be exported. - :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - - _validation = { - 'kty': {'required': True}, - } - - _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'public_exponent': {'key': 'public_exponent', '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'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". - :paramtype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword public_exponent: The public exponent for a RSA key. - :paramtype public_exponent: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - :keyword release_policy: The policy rules under which the key can be exported. - :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kwargs['kty'] - self.key_size = kwargs.get('key_size', None) - self.public_exponent = kwargs.get('public_exponent', 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) - self.release_policy = kwargs.get('release_policy', None) - - -class KeyExportParameters(msrest.serialization.Model): - """The export key parameters. - - :ivar wrapping_key: The export key encryption Json web key. This key MUST be a RSA key that - supports encryption. - :vartype wrapping_key: ~azure.keyvault.v7_3.models.JsonWebKey - :ivar wrapping_kid: The export key encryption key identifier. This key MUST be a RSA key that - supports encryption. - :vartype wrapping_kid: str - :ivar enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". - :vartype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm - """ - - _attribute_map = { - 'wrapping_key': {'key': 'wrappingKey', 'type': 'JsonWebKey'}, - 'wrapping_kid': {'key': 'wrappingKid', 'type': 'str'}, - 'enc': {'key': 'enc', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword wrapping_key: The export key encryption Json web key. This key MUST be a RSA key that - supports encryption. - :paramtype wrapping_key: ~azure.keyvault.v7_3.models.JsonWebKey - :keyword wrapping_kid: The export key encryption key identifier. This key MUST be a RSA key - that supports encryption. - :paramtype wrapping_kid: str - :keyword enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". - :paramtype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm - """ - super(KeyExportParameters, self).__init__(**kwargs) - self.wrapping_key = kwargs.get('wrapping_key', None) - self.wrapping_kid = kwargs.get('wrapping_kid', None) - self.enc = kwargs.get('enc', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar release_policy: The policy rules under which the key can be exported. - :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - - _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}'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword release_policy: The policy rules under which the key can be exported. - :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - self.release_policy = kwargs.get('release_policy', None) - - -class KeyListResult(msrest.serialization.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_3.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(msrest.serialization.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 - :ivar iv: - :vartype iv: bytes - :ivar authentication_tag: - :vartype authentication_tag: bytes - :ivar additional_authenticated_data: - :vartype additional_authenticated_data: bytes - """ - - _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - 'iv': {'readonly': True}, - 'authentication_tag': {'readonly': True}, - 'additional_authenticated_data': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'authentication_tag': {'key': 'tag', 'type': 'base64'}, - 'additional_authenticated_data': {'key': 'aad', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) - self.kid = None - self.result = None - self.iv = None - self.authentication_tag = None - self.additional_authenticated_data = None - - -class KeyOperationsParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". - :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - :ivar iv: Initialization vector for symmetric algorithms. - :vartype iv: bytes - :ivar aad: Additional data to authenticate but not encrypt/decrypt when using authenticated - crypto algorithms. - :vartype aad: bytes - :ivar tag: The tag to authenticate when performing decryption with an authenticated algorithm. - :vartype tag: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'aad': {'key': 'aad', 'type': 'base64'}, - 'tag': {'key': 'tag', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". - :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - :keyword iv: Initialization vector for symmetric algorithms. - :paramtype iv: bytes - :keyword aad: Additional data to authenticate but not encrypt/decrypt when using authenticated - crypto algorithms. - :paramtype aad: bytes - :keyword tag: The tag to authenticate when performing decryption with an authenticated - algorithm. - :paramtype tag: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - self.iv = kwargs.get('iv', None) - self.aad = kwargs.get('aad', None) - self.tag = kwargs.get('tag', None) - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar 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". - :vartype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_3.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 - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword 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". - :paramtype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName - """ - 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 KeyReleaseParameters(msrest.serialization.Model): - """The release key parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar target_attestation_token: Required. The attestation assertion for the target of the key - release. - :vartype target_attestation_token: str - :ivar nonce: A client provided nonce for freshness. - :vartype nonce: str - :ivar enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". - :vartype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm - """ - - _validation = { - 'target_attestation_token': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'target_attestation_token': {'key': 'target', 'type': 'str'}, - 'nonce': {'key': 'nonce', 'type': 'str'}, - 'enc': {'key': 'enc', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword target_attestation_token: Required. The attestation assertion for the target of the - key release. - :paramtype target_attestation_token: str - :keyword nonce: A client provided nonce for freshness. - :paramtype nonce: str - :keyword enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". - :paramtype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm - """ - super(KeyReleaseParameters, self).__init__(**kwargs) - self.target_attestation_token = kwargs['target_attestation_token'] - self.nonce = kwargs.get('nonce', None) - self.enc = kwargs.get('enc', None) - - -class KeyReleasePolicy(msrest.serialization.Model): - """KeyReleasePolicy. - - :ivar content_type: Content type and version of key release policy. - :vartype content_type: str - :ivar immutable: Defines the mutability state of the policy. Once marked immutable, this flag - cannot be reset and the policy cannot be changed under any circumstances. - :vartype immutable: bool - :ivar encoded_policy: Blob encoding the policy rules under which the key can be released. - :vartype encoded_policy: bytes - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'immutable': {'key': 'immutable', 'type': 'bool'}, - 'encoded_policy': {'key': 'data', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: Content type and version of key release policy. - :paramtype content_type: str - :keyword immutable: Defines the mutability state of the policy. Once marked immutable, this - flag cannot be reset and the policy cannot be changed under any circumstances. - :paramtype immutable: bool - :keyword encoded_policy: Blob encoding the policy rules under which the key can be released. - :paramtype encoded_policy: bytes - """ - super(KeyReleasePolicy, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', "application/json; charset=utf-8") - self.immutable = kwargs.get('immutable', None) - self.encoded_policy = kwargs.get('encoded_policy', None) - - -class KeyReleaseResult(msrest.serialization.Model): - """The release result, containing the released key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A signed object containing the released key. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyReleaseResult, self).__init__(**kwargs) - self.value = None - - -class KeyRestoreParameters(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeyRotationPolicy(msrest.serialization.Model): - """Management policy for a key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The key policy id. - :vartype id: str - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a key. - For preview, lifetimeActions can only have two items at maximum: one for rotate, one for - notify. Notification time would be default to 30 days before expiry and it is not configurable. - :vartype lifetime_actions: list[~azure.keyvault.v7_3.models.LifetimeActions] - :ivar attributes: The key rotation policy attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.KeyRotationPolicyAttributes - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeActions]'}, - 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - key. For preview, lifetimeActions can only have two items at maximum: one for rotate, one for - notify. Notification time would be default to 30 days before expiry and it is not configurable. - :paramtype lifetime_actions: list[~azure.keyvault.v7_3.models.LifetimeActions] - :keyword attributes: The key rotation policy attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.KeyRotationPolicyAttributes - """ - super(KeyRotationPolicy, self).__init__(**kwargs) - self.id = None - self.lifetime_actions = kwargs.get('lifetime_actions', None) - self.attributes = kwargs.get('attributes', None) - - -class KeyRotationPolicyAttributes(msrest.serialization.Model): - """The key rotation policy attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar expiry_time: The expiryTime will be applied on the new key version. It should be at least - 28 days. It will be in ISO 8601 Format. Examples: 90 days: P90D, 3 months: P3M, 48 hours: - PT48H, 1 year and 10 days: P1Y10D. - :vartype expiry_time: str - :ivar created: The key rotation policy created time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: The key rotation policy's last updated time in UTC. - :vartype updated: ~datetime.datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword expiry_time: The expiryTime will be applied on the new key version. It should be at - least 28 days. It will be in ISO 8601 Format. Examples: 90 days: P90D, 3 months: P3M, 48 hours: - PT48H, 1 year and 10 days: P1Y10D. - :paramtype expiry_time: str - """ - super(KeyRotationPolicyAttributes, self).__init__(**kwargs) - self.expiry_time = kwargs.get('expiry_time', None) - self.created = None - self.updated = None - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar release_policy: The policy rules under which the key can be exported. - :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - - _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword release_policy: The policy rules under which the key can be exported. - :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy - """ - 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) - self.release_policy = kwargs.get('release_policy', 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_3.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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 LifetimeActions(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a key. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_3.models.LifetimeActionsTrigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_3.models.LifetimeActionsType - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'LifetimeActionsTrigger'}, - 'action': {'key': 'action', 'type': 'LifetimeActionsType'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_3.models.LifetimeActionsTrigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_3.models.LifetimeActionsType - """ - super(LifetimeActions, self).__init__(**kwargs) - self.trigger = kwargs.get('trigger', None) - self.action = kwargs.get('action', None) - - -class LifetimeActionsTrigger(msrest.serialization.Model): - """A condition to be satisfied for an action to be executed. - - :ivar time_after_create: Time after creation to attempt to rotate. It only applies to rotate. - It will be in ISO 8601 duration format. Example: 90 days : "P90D". - :vartype time_after_create: str - :ivar time_before_expiry: Time before expiry to attempt to rotate or notify. It will be in ISO - 8601 duration format. Example: 90 days : "P90D". - :vartype time_before_expiry: str - """ - - _attribute_map = { - 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, - 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword time_after_create: Time after creation to attempt to rotate. It only applies to - rotate. It will be in ISO 8601 duration format. Example: 90 days : "P90D". - :paramtype time_after_create: str - :keyword time_before_expiry: Time before expiry to attempt to rotate or notify. It will be in - ISO 8601 duration format. Example: 90 days : "P90D". - :paramtype time_before_expiry: str - """ - super(LifetimeActionsTrigger, self).__init__(**kwargs) - self.time_after_create = kwargs.get('time_after_create', None) - self.time_before_expiry = kwargs.get('time_before_expiry', None) - - -class LifetimeActionsType(msrest.serialization.Model): - """The action that will be executed. - - :ivar type: The type of the action. Possible values include: "rotate", "notify". - :vartype type: str or ~azure.keyvault.v7_3.models.ActionType - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword type: The type of the action. Possible values include: "rotate", "notify". - :paramtype type: str or ~azure.keyvault.v7_3.models.ActionType - """ - super(LifetimeActionsType, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - - -class RandomBytes(msrest.serialization.Model): - """The get random bytes response object containing the bytes. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The bytes encoded as a base64url string. - :vartype value: bytes - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: Required. The bytes encoded as a base64url string. - :paramtype value: bytes - """ - super(RandomBytes, self).__init__(**kwargs) - self.value = kwargs['value'] diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models_py3.py index 5d6302bc91da..f9189ee819af 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): +class Attributes(_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. @@ -33,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -61,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -69,7 +71,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -79,24 +81,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -105,7 +103,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -115,24 +113,24 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, + "release_policy": {"key": "release_policy", "type": "KeyReleasePolicy"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ @@ -140,12 +138,12 @@ def __init__( :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword release_policy: The policy rules under which the key can be exported. :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -162,7 +160,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -179,29 +177,29 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, + "release_policy": {"key": "release_policy", "type": "KeyReleasePolicy"}, + "recovery_id": {"key": "recoveryId", "type": "str"}, + "scheduled_purge_date": {"key": "scheduledPurgeDate", "type": "unix-time"}, + "deleted_date": {"key": "deletedDate", "type": "unix-time"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, recovery_id: Optional[str] = None, **kwargs ): @@ -210,7 +208,7 @@ def __init__( :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword release_policy: The policy rules under which the key can be exported. :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy @@ -218,13 +216,13 @@ def __init__( key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, release_policy=release_policy, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, release_policy=release_policy, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -233,7 +231,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -241,21 +239,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -264,10 +262,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -283,7 +281,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -298,26 +296,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -327,19 +325,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -352,27 +350,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -386,68 +380,59 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class GetRandomBytesRequest(msrest.serialization.Model): +class GetRandomBytesRequest(_serialization.Model): """The get random bytes request object. All required parameters must be populated in order to send to Azure. - :ivar count: Required. The requested number of random bytes. + :ivar count: The requested number of random bytes. Required. :vartype count: int """ _validation = { - 'count': {'required': True, 'maximum': 128, 'minimum': 1}, + "count": {"required": True, "maximum": 128, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: int, - **kwargs - ): + def __init__(self, *, count: int, **kwargs): """ - :keyword count: Required. The requested number of random bytes. + :keyword count: The requested number of random bytes. Required. :paramtype count: int """ - super(GetRandomBytesRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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", "oct-HSM". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -471,8 +456,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: Protected Key, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -481,29 +466,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -515,7 +500,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -524,8 +509,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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", "oct-HSM". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -549,15 +534,15 @@ def __init__( :paramtype k: bytes :keyword t: Protected Key, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -596,31 +581,31 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_3.models.DeletionRecoveryLevel :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "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'}, - 'exportable': {'key': 'exportable', 'type': 'bool'}, + "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"}, + "exportable": {"key": "exportable", "type": "bool"}, } def __init__( @@ -642,19 +627,19 @@ def __init__( :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None self.exportable = exportable -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -664,46 +649,46 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName :ivar release_policy: The policy rules under which the key can be exported. :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'public_exponent': {'key': 'public_exponent', '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'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + "kty": {"key": "kty", "type": "str"}, + "key_size": {"key": "key_size", "type": "int"}, + "public_exponent": {"key": "public_exponent", "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"}, + "release_policy": {"key": "release_policy", "type": "KeyReleasePolicy"}, } def __init__( self, *, - kty: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, public_exponent: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype kty: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -713,15 +698,15 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName :keyword release_policy: The policy rules under which the key can be exported. :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.public_exponent = public_exponent @@ -732,7 +717,7 @@ def __init__( self.release_policy = release_policy -class KeyExportParameters(msrest.serialization.Model): +class KeyExportParameters(_serialization.Model): """The export key parameters. :ivar wrapping_key: The export key encryption Json web key. This key MUST be a RSA key that @@ -741,23 +726,23 @@ class KeyExportParameters(msrest.serialization.Model): :ivar wrapping_kid: The export key encryption key identifier. This key MUST be a RSA key that supports encryption. :vartype wrapping_kid: str - :ivar enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". + :ivar enc: The encryption algorithm to use to protected the exported key material. Known values + are: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", and "RSA_AES_KEY_WRAP_384". :vartype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm """ _attribute_map = { - 'wrapping_key': {'key': 'wrappingKey', 'type': 'JsonWebKey'}, - 'wrapping_kid': {'key': 'wrappingKid', 'type': 'str'}, - 'enc': {'key': 'enc', 'type': 'str'}, + "wrapping_key": {"key": "wrappingKey", "type": "JsonWebKey"}, + "wrapping_kid": {"key": "wrappingKid", "type": "str"}, + "enc": {"key": "enc", "type": "str"}, } def __init__( self, *, - wrapping_key: Optional["JsonWebKey"] = None, + wrapping_key: Optional["_models.JsonWebKey"] = None, wrapping_kid: Optional[str] = None, - enc: Optional[Union[str, "KeyEncryptionAlgorithm"]] = None, + enc: Optional[Union[str, "_models.KeyEncryptionAlgorithm"]] = None, **kwargs ): """ @@ -767,68 +752,68 @@ def __init__( :keyword wrapping_kid: The export key encryption key identifier. This key MUST be a RSA key that supports encryption. :paramtype wrapping_kid: str - :keyword enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". + :keyword enc: The encryption algorithm to use to protected the exported key material. Known + values are: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", and "RSA_AES_KEY_WRAP_384". :paramtype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm """ - super(KeyExportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.wrapping_key = wrapping_key self.wrapping_kid = wrapping_kid self.enc = enc -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_3.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar release_policy: The policy rules under which the key can be exported. :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ _validation = { - 'key': {'required': True}, + "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}'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + "hsm": {"key": "Hsm", "type": "bool"}, + "key": {"key": "key", "type": "JsonWebKey"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "release_policy": {"key": "release_policy", "type": "KeyReleasePolicy"}, } def __init__( self, *, - key: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_3.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword release_policy: The policy rules under which the key can be exported. :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes @@ -836,7 +821,7 @@ def __init__( self.release_policy = release_policy -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -849,27 +834,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -887,28 +868,24 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - 'iv': {'readonly': True}, - 'authentication_tag': {'readonly': True}, - 'additional_authenticated_data': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, + "iv": {"readonly": True}, + "authentication_tag": {"readonly": True}, + "additional_authenticated_data": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'authentication_tag': {'key': 'tag', 'type': 'base64'}, - 'additional_authenticated_data': {'key': 'aad', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, + "iv": {"key": "iv", "type": "base64"}, + "authentication_tag": {"key": "tag", "type": "base64"}, + "additional_authenticated_data": {"key": "aad", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None self.iv = None @@ -916,14 +893,14 @@ def __init__( self.additional_authenticated_data = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", "A128CBC", "A192CBC", + "A256CBC", "A128CBCPAD", "A192CBCPAD", and "A256CBCPAD". :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes @@ -937,22 +914,22 @@ class KeyOperationsParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - 'iv': {'key': 'iv', 'type': 'base64'}, - 'aad': {'key': 'aad', 'type': 'base64'}, - 'tag': {'key': 'tag', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, + "iv": {"key": "iv", "type": "base64"}, + "aad": {"key": "aad", "type": "base64"}, + "tag": {"key": "tag", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, iv: Optional[bytes] = None, aad: Optional[bytes] = None, @@ -960,9 +937,9 @@ def __init__( **kwargs ): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", - "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD". + "A128CBC", "A192CBC", "A256CBC", "A128CBCPAD", "A192CBCPAD", and "A256CBCPAD". :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes @@ -975,7 +952,7 @@ def __init__( algorithm. :paramtype tag: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value self.iv = iv @@ -983,56 +960,56 @@ def __init__( self.tag = tag -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool - :ivar 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". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :vartype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_3.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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool - :keyword 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". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM". :paramtype key_type: str or ~azure.keyvault.v7_3.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_3.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -1040,29 +1017,29 @@ def __init__( self.curve = curve -class KeyReleaseParameters(msrest.serialization.Model): +class KeyReleaseParameters(_serialization.Model): """The release key parameters. All required parameters must be populated in order to send to Azure. - :ivar target_attestation_token: Required. The attestation assertion for the target of the key - release. + :ivar target_attestation_token: The attestation assertion for the target of the key release. + Required. :vartype target_attestation_token: str :ivar nonce: A client provided nonce for freshness. :vartype nonce: str - :ivar enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". + :ivar enc: The encryption algorithm to use to protected the exported key material. Known values + are: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", and "RSA_AES_KEY_WRAP_384". :vartype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm """ _validation = { - 'target_attestation_token': {'required': True, 'min_length': 1}, + "target_attestation_token": {"required": True, "min_length": 1}, } _attribute_map = { - 'target_attestation_token': {'key': 'target', 'type': 'str'}, - 'nonce': {'key': 'nonce', 'type': 'str'}, - 'enc': {'key': 'enc', 'type': 'str'}, + "target_attestation_token": {"key": "target", "type": "str"}, + "nonce": {"key": "nonce", "type": "str"}, + "enc": {"key": "enc", "type": "str"}, } def __init__( @@ -1070,26 +1047,26 @@ def __init__( *, target_attestation_token: str, nonce: Optional[str] = None, - enc: Optional[Union[str, "KeyEncryptionAlgorithm"]] = None, + enc: Optional[Union[str, "_models.KeyEncryptionAlgorithm"]] = None, **kwargs ): """ - :keyword target_attestation_token: Required. The attestation assertion for the target of the - key release. + :keyword target_attestation_token: The attestation assertion for the target of the key release. + Required. :paramtype target_attestation_token: str :keyword nonce: A client provided nonce for freshness. :paramtype nonce: str - :keyword enc: The encryption algorithm to use to protected the exported key material. Possible - values include: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", "RSA_AES_KEY_WRAP_384". + :keyword enc: The encryption algorithm to use to protected the exported key material. Known + values are: "CKM_RSA_AES_KEY_WRAP", "RSA_AES_KEY_WRAP_256", and "RSA_AES_KEY_WRAP_384". :paramtype enc: str or ~azure.keyvault.v7_3.models.KeyEncryptionAlgorithm """ - super(KeyReleaseParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.target_attestation_token = target_attestation_token self.nonce = nonce self.enc = enc -class KeyReleasePolicy(msrest.serialization.Model): +class KeyReleasePolicy(_serialization.Model): """KeyReleasePolicy. :ivar content_type: Content type and version of key release policy. @@ -1102,15 +1079,15 @@ class KeyReleasePolicy(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'immutable': {'key': 'immutable', 'type': 'bool'}, - 'encoded_policy': {'key': 'data', 'type': 'base64'}, + "content_type": {"key": "contentType", "type": "str"}, + "immutable": {"key": "immutable", "type": "bool"}, + "encoded_policy": {"key": "data", "type": "base64"}, } def __init__( self, *, - content_type: Optional[str] = "application/json; charset=utf-8", + content_type: str = "application/json; charset=utf-8", immutable: Optional[bool] = None, encoded_policy: Optional[bytes] = None, **kwargs @@ -1124,13 +1101,13 @@ def __init__( :keyword encoded_policy: Blob encoding the policy rules under which the key can be released. :paramtype encoded_policy: bytes """ - super(KeyReleasePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.immutable = immutable self.encoded_policy = encoded_policy -class KeyReleaseResult(msrest.serialization.Model): +class KeyReleaseResult(_serialization.Model): """The release result, containing the released key. Variables are only populated by the server, and will be ignored when sending a request. @@ -1140,55 +1117,46 @@ class KeyReleaseResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyReleaseResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeyRotationPolicy(msrest.serialization.Model): +class KeyRotationPolicy(_serialization.Model): """Management policy for a key. Variables are only populated by the server, and will be ignored when sending a request. @@ -1204,20 +1172,20 @@ class KeyRotationPolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeActions]'}, - 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, + "id": {"key": "id", "type": "str"}, + "lifetime_actions": {"key": "lifetimeActions", "type": "[LifetimeActions]"}, + "attributes": {"key": "attributes", "type": "KeyRotationPolicyAttributes"}, } def __init__( self, *, - lifetime_actions: Optional[List["LifetimeActions"]] = None, - attributes: Optional["KeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[List["_models.LifetimeActions"]] = None, + attributes: Optional["_models.KeyRotationPolicyAttributes"] = None, **kwargs ): """ @@ -1228,13 +1196,13 @@ def __init__( :keyword attributes: The key rotation policy attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.KeyRotationPolicyAttributes """ - super(KeyRotationPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.lifetime_actions = lifetime_actions self.attributes = attributes -class KeyRotationPolicyAttributes(msrest.serialization.Model): +class KeyRotationPolicyAttributes(_serialization.Model): """The key rotation policy attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -1250,42 +1218,37 @@ class KeyRotationPolicyAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"readonly": True}, } _attribute_map = { - 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, + "expiry_time": {"key": "expiryTime", "type": "str"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, } - def __init__( - self, - *, - expiry_time: Optional[str] = None, - **kwargs - ): + def __init__(self, *, expiry_time: Optional[str] = None, **kwargs): """ :keyword expiry_time: The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D. :paramtype expiry_time: str """ - super(KeyRotationPolicyAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.expiry_time = expiry_time self.created = None self.updated = None -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -1293,37 +1256,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -1331,26 +1288,26 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar release_policy: The policy rules under which the key can be exported. :vartype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "release_policy": {"key": "release_policy", "type": "KeyReleasePolicy"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ @@ -1359,19 +1316,19 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_3.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_3.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword release_policy: The policy rules under which the key can be exported. :paramtype release_policy: ~azure.keyvault.v7_3.models.KeyReleasePolicy """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags self.release_policy = release_policy -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -1381,75 +1338,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_3.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1459,24 +1412,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeActions(msrest.serialization.Model): +class LifetimeActions(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a key. :ivar trigger: The condition that will execute the action. @@ -1486,15 +1435,15 @@ class LifetimeActions(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'LifetimeActionsTrigger'}, - 'action': {'key': 'action', 'type': 'LifetimeActionsType'}, + "trigger": {"key": "trigger", "type": "LifetimeActionsTrigger"}, + "action": {"key": "action", "type": "LifetimeActionsType"}, } def __init__( self, *, - trigger: Optional["LifetimeActionsTrigger"] = None, - action: Optional["LifetimeActionsType"] = None, + trigger: Optional["_models.LifetimeActionsTrigger"] = None, + action: Optional["_models.LifetimeActionsType"] = None, **kwargs ): """ @@ -1503,12 +1452,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_3.models.LifetimeActionsType """ - super(LifetimeActions, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class LifetimeActionsTrigger(msrest.serialization.Model): +class LifetimeActionsTrigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar time_after_create: Time after creation to attempt to rotate. It only applies to rotate. @@ -1520,17 +1469,11 @@ class LifetimeActionsTrigger(msrest.serialization.Model): """ _attribute_map = { - 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, - 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, + "time_after_create": {"key": "timeAfterCreate", "type": "str"}, + "time_before_expiry": {"key": "timeBeforeExpiry", "type": "str"}, } - def __init__( - self, - *, - time_after_create: Optional[str] = None, - time_before_expiry: Optional[str] = None, - **kwargs - ): + def __init__(self, *, time_after_create: Optional[str] = None, time_before_expiry: Optional[str] = None, **kwargs): """ :keyword time_after_create: Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: 90 days : "P90D". @@ -1539,62 +1482,52 @@ def __init__( ISO 8601 duration format. Example: 90 days : "P90D". :paramtype time_before_expiry: str """ - super(LifetimeActionsTrigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.time_after_create = time_after_create self.time_before_expiry = time_before_expiry -class LifetimeActionsType(msrest.serialization.Model): +class LifetimeActionsType(_serialization.Model): """The action that will be executed. - :ivar type: The type of the action. Possible values include: "rotate", "notify". + :ivar type: The type of the action. Known values are: "rotate" and "notify". :vartype type: str or ~azure.keyvault.v7_3.models.ActionType """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword type: The type of the action. Possible values include: "rotate", "notify". + :keyword type: The type of the action. Known values are: "rotate" and "notify". :paramtype type: str or ~azure.keyvault.v7_3.models.ActionType """ - super(LifetimeActionsType, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type -class RandomBytes(msrest.serialization.Model): +class RandomBytes(_serialization.Model): """The get random bytes response object containing the bytes. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The bytes encoded as a base64url string. + :ivar value: The bytes encoded as a base64url string. Required. :vartype value: bytes """ _validation = { - 'value': {'required': True}, + "value": {"required": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - value: bytes, - **kwargs - ): + def __init__(self, *, value: bytes, **kwargs): """ - :keyword value: Required. The bytes encoded as a base64url string. + :keyword value: The bytes encoded as a base64url string. Required. :paramtype value: bytes """ - super(RandomBytes, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_key_vault_client_operations.py index b829ffcfbd05..359a122f14e0 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_key_vault_client_operations.py @@ -6,1014 +6,871 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_rotate_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rotate_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/rotate") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_release_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_release_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/release") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_rotation_policy_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_rotation_policy_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/rotationpolicy") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_rotation_policy_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_rotation_policy_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/rotationpolicy") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_random_bytes_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_random_bytes_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/rng") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore @distributed_trace - def rotate_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def rotate_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _models.KeyBundle: """Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str :param key_name: The name of key to be rotated. The system will generate a new version in the - specified key. + specified key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_rotate_key_request( key_name=key_name, api_version=api_version, - template_url=self.rotate_key.metadata['url'], + template_url=self.rotate_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - rotate_key.metadata = {'url': "/keys/{key-name}/rotate"} # type: ignore + rotate_key.metadata = {"url": "/keys/{key-name}/rotate"} # type: ignore - - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1021,71 +878,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -1093,67 +1019,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -1161,29 +1161,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -1191,170 +1207,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1368,34 +1382,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1403,53 +1409,57 @@ def get_keys( 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. Required. :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. Default value is None. :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_3.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1463,34 +1473,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -1505,65 +1505,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -1577,70 +1583,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1652,29 +1812,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -1682,46 +1858,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -1731,29 +1981,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -1761,75 +2027,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -1837,46 +2187,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyVerifyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -1885,29 +2307,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -1915,46 +2353,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -1964,29 +2476,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1994,46 +2522,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_3.models.KeyOperationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -2041,29 +2639,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -2071,74 +2685,159 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore + + @overload + def release( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyReleaseParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyReleaseResult: + """Releases a key. + + The release key operation is applicable to all key types. The target key must be marked + exportable. This operation requires the keys/release permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to get. Required. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. + :type key_version: str + :param parameters: The parameters for the key release operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def release( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyReleaseResult: + """Releases a key. + + The release key operation is applicable to all key types. The target key must be marked + exportable. This operation requires the keys/release permission. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key to get. Required. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. + :type key_version: str + :param parameters: The parameters for the key release operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyReleaseResult or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def release( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyReleaseParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyReleaseResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyReleaseParameters, IO], + **kwargs: Any + ) -> _models.KeyReleaseResult: """Releases a key. The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :type key_version: str - :param parameters: The parameters for the key release operation. - :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters + :param parameters: The parameters for the key release operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.KeyReleaseParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyReleaseResult, or the result of cls(response) + :return: KeyReleaseResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyReleaseResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyReleaseResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyReleaseResult] - _json = self._serialize.body(parameters, 'KeyReleaseParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyReleaseParameters") request = build_release_request( key_name=key_name, @@ -2146,44 +2845,41 @@ def release( api_version=api_version, content_type=content_type, json=_json, - template_url=self.release.metadata['url'], + content=_content, + template_url=self.release.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyReleaseResult', pipeline_response) + deserialized = self._deserialize("KeyReleaseResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - release.metadata = {'url': "/keys/{key-name}/{key-version}/release"} # type: ignore - + release.metadata = {"url": "/keys/{key-name}/{key-version}/release"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -2192,54 +2888,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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_3.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2253,160 +2952,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -2414,254 +3103,394 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore @distributed_trace - def get_key_rotation_policy( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyRotationPolicy" + def get_key_rotation_policy(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _models.KeyRotationPolicy: """Lists the policy for a key. The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key 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. Required. :type vault_base_url: str - :param key_name: The name of the key in a given key vault. + :param key_name: The name of the key in a given key vault. Required. :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyRotationPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyRotationPolicy] - request = build_get_key_rotation_policy_request( key_name=key_name, api_version=api_version, - template_url=self.get_key_rotation_policy.metadata['url'], + template_url=self.get_key_rotation_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyRotationPolicy', pipeline_response) + deserialized = self._deserialize("KeyRotationPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key_rotation_policy.metadata = {'url': "/keys/{key-name}/rotationpolicy"} # type: ignore + get_key_rotation_policy.metadata = {"url": "/keys/{key-name}/rotationpolicy"} # type: ignore + @overload + def update_key_rotation_policy( + self, + vault_base_url: str, + key_name: str, + key_rotation_policy: _models.KeyRotationPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyRotationPolicy: + """Updates the rotation policy for a key. + + Set specified members in the key policy. Leave others as undefined. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key in the given vault. Required. + :type key_name: str + :param key_rotation_policy: The policy for the key. Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key_rotation_policy( + self, + vault_base_url: str, + key_name: str, + key_rotation_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyRotationPolicy: + """Updates the rotation policy for a key. + + Set specified members in the key policy. Leave others as undefined. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key in the given vault. Required. + :type key_name: str + :param key_rotation_policy: The policy for the key. Required. + :type key_rotation_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyRotationPolicy or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key_rotation_policy( self, - vault_base_url, # type: str - key_name, # type: str - key_rotation_policy, # type: "_models.KeyRotationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyRotationPolicy" + vault_base_url: str, + key_name: str, + key_rotation_policy: Union[_models.KeyRotationPolicy, IO], + **kwargs: Any + ) -> _models.KeyRotationPolicy: """Updates the rotation policy for a key. Set specified members in the key policy. Leave others as undefined. This operation requires the keys/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. Required. :type vault_base_url: str - :param key_name: The name of the key in the given vault. + :param key_name: The name of the key in the given vault. Required. :type key_name: str - :param key_rotation_policy: The policy for the key. - :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy + :param key_rotation_policy: The policy for the key. Is either a model type or a IO type. + Required. + :type key_rotation_policy: ~azure.keyvault.v7_3.models.KeyRotationPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyRotationPolicy, or the result of cls(response) + :return: KeyRotationPolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.KeyRotationPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyRotationPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyRotationPolicy] - _json = self._serialize.body(key_rotation_policy, 'KeyRotationPolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(key_rotation_policy, (IO, bytes)): + _content = key_rotation_policy + else: + _json = self._serialize.body(key_rotation_policy, "KeyRotationPolicy") request = build_update_key_rotation_policy_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key_rotation_policy.metadata['url'], + content=_content, + template_url=self.update_key_rotation_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyRotationPolicy', pipeline_response) + deserialized = self._deserialize("KeyRotationPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key_rotation_policy.metadata = {'url': "/keys/{key-name}/rotationpolicy"} # type: ignore - + update_key_rotation_policy.metadata = {"url": "/keys/{key-name}/rotationpolicy"} # type: ignore - @distributed_trace + @overload def get_random_bytes( self, - vault_base_url, # type: str - parameters, # type: "_models.GetRandomBytesRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RandomBytes" + vault_base_url: str, + parameters: _models.GetRandomBytesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RandomBytes: """Get the requested number of bytes containing random values. Get the requested number of bytes containing random values from a managed HSM. - :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The request object to get random bytes. + :param parameters: The request object to get random bytes. Required. :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RandomBytes, or the result of cls(response) + :return: RandomBytes or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.RandomBytes - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_random_bytes( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RandomBytes: + """Get the requested number of bytes containing random values. + + Get the requested number of bytes containing random values from a managed HSM. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The request object to get random bytes. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RandomBytes or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RandomBytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_random_bytes( + self, vault_base_url: str, parameters: Union[_models.GetRandomBytesRequest, IO], **kwargs: Any + ) -> _models.RandomBytes: + """Get the requested number of bytes containing random values. + + Get the requested number of bytes containing random values from a managed HSM. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param parameters: The request object to get random bytes. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.GetRandomBytesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RandomBytes or the result of cls(response) + :rtype: ~azure.keyvault.v7_3.models.RandomBytes + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RandomBytes"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'GetRandomBytesRequest') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RandomBytes] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GetRandomBytesRequest") request = build_get_random_bytes_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get_random_bytes.metadata['url'], + content=_content, + template_url=self.get_random_bytes.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RandomBytes', pipeline_response) + deserialized = self._deserialize("RandomBytes", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_random_bytes.metadata = {'url': "/rng"} # type: ignore - + get_random_bytes.metadata = {"url": "/rng"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_patch.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated_models.py index 84278b8484e2..8bc1848d4082 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated_models.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated_models.py @@ -1,26 +1,33 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # 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. # -------------------------------------------------------------------------- -# pylint: skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713) -from enum import Enum, EnumMeta -import msrest.serialization -from six import with_metaclass +import datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union +from ._generated import _serialization -class Attributes(msrest.serialization.Model): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from ._generated import models as _models + + +class Attributes(_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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -28,31 +35,43 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires self.created = None self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -62,56 +81,66 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar key: The Json web key. + :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey + :ivar attributes: The key management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, + *, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): - super(KeyBundle, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) + """ + :keyword key: The Json web key. + :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey + :keyword attributes: The key management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.key = key + self.attributes = attributes + self.tags = tags self.managed = None @@ -120,18 +149,18 @@ class DeletedKeyBundle(KeyBundle): 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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar key: The Json web key. + :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey + :ivar attributes: The key management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted key. - :type recovery_id: str + :vartype recovery_id: str :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. @@ -139,66 +168,94 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, + *, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword key: The Json web key. + :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey + :keyword attributes: The key management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + key. + :paramtype recovery_id: str + """ + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) + self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. 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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar kid: Key identifier. + :vartype kid: str + :ivar attributes: The key management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, + *, + kid: Optional[str] = None, + attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', None) - self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) + """ + :keyword kid: Key identifier. + :paramtype kid: str + :keyword attributes: The key management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.kid = kid + self.attributes = attributes + self.tags = tags self.managed = None @@ -207,18 +264,18 @@ class DeletedKeyItem(KeyItem): 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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar kid: Key identifier. + :vartype kid: str + :ivar attributes: The key management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted key. - :type recovery_id: str + :vartype recovery_id: str :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. @@ -226,32 +283,48 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, + *, + kid: Optional[str] = None, + attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword kid: Key identifier. + :paramtype kid: str + :keyword attributes: The key management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + key. + :paramtype recovery_id: str + """ + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -264,25 +337,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -296,108 +367,159 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class JsonWebKey(msrest.serialization.Model): - # pylint: disable=too-many-instance-attributes +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """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 + :ivar kid: Key identifier. + :vartype kid: str + :ivar kty: JsonWebKey Key Type (kty), as defined in + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str] + :ivar n: RSA modulus. + :vartype n: bytes + :ivar e: RSA public exponent. + :vartype e: bytes + :ivar d: RSA private exponent, or the D component of an EC private key. + :vartype d: bytes + :ivar dp: RSA private key parameter. + :vartype dp: bytes + :ivar dq: RSA private key parameter. + :vartype dq: bytes + :ivar qi: RSA private key parameter. + :vartype qi: bytes + :ivar p: RSA secret prime. + :vartype p: bytes + :ivar q: RSA secret prime, with p < q. + :vartype q: bytes + :ivar k: Symmetric key. + :vartype k: bytes + :ivar t: HSM Token, used with 'Bring Your Own Key'. + :vartype t: bytes + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". + :vartype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + :ivar x: X component of an EC public key. + :vartype x: bytes + :ivar y: Y component of an EC public key. + :vartype 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'}, + "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: Optional[str] = None, + kty: Optional[Union[str, "_models.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, "_models.JsonWebKeyCurveName"]] = None, + x: Optional[bytes] = None, + y: Optional[bytes] = None, **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) + """ + :keyword kid: Key identifier. + :paramtype kid: str + :keyword kty: JsonWebKey Key Type (kty), as defined in + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str] + :keyword n: RSA modulus. + :paramtype n: bytes + :keyword e: RSA public exponent. + :paramtype e: bytes + :keyword d: RSA private exponent, or the D component of an EC private key. + :paramtype d: bytes + :keyword dp: RSA private key parameter. + :paramtype dp: bytes + :keyword dq: RSA private key parameter. + :paramtype dq: bytes + :keyword qi: RSA private key parameter. + :paramtype qi: bytes + :keyword p: RSA secret prime. + :paramtype p: bytes + :keyword q: RSA secret prime, with p < q. + :paramtype q: bytes + :keyword k: Symmetric key. + :paramtype k: bytes + :keyword t: HSM Token, used with 'Bring Your Own Key'. + :paramtype t: bytes + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". + :paramtype crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + :keyword x: X component of an EC public key. + :paramtype x: bytes + :keyword y: Y component of an EC public key. + :paramtype y: bytes + """ + super().__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): @@ -405,12 +527,12 @@ class KeyAttributes(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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -420,124 +542,174 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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(KeyAttributes, self).__init__(**kwargs) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_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". - :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: The attributes of a key managed by the key vault service. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :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". - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". + :vartype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar key_ops: + :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] + :ivar key_attributes: The attributes of a key managed by the key vault service. + :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". + :vartype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: 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 ): - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) + """ + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". + :paramtype kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword key_ops: + :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] + :keyword key_attributes: The attributes of a key managed by the key vault service. + :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". + :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + """ + super().__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(msrest.serialization.Model): +class KeyImportParameters(_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. - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar hsm: Whether to import as a hardware key (HSM) or software key. + :vartype hsm: bool + :ivar key: The Json web key. Required. + :vartype key: ~azure.keyvault.v7_1.models.JsonWebKey + :ivar key_attributes: The key management attributes. + :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "_models.JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) + """ + :keyword hsm: Whether to import as a hardware key (HSM) or software key. + :paramtype hsm: bool + :keyword key: The Json web key. Required. + :paramtype key: ~azure.keyvault.v7_1.models.JsonWebKey + :keyword key_attributes: The key management attributes. + :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.hsm = hsm + self.key = key + self.key_attributes = key_attributes + self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -550,25 +722,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -580,179 +750,222 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_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_1.models.JsonWebKeyEncryptionAlgorithm - :param value: Required. - :type value: bytes + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". + :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm + :ivar value: Required. + :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): + """ + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". + :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm + :keyword value: Required. + :paramtype value: bytes + """ + super().__init__(**kwargs) + self.algorithm = algorithm + self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. - :param exportable: Not supported in this version. 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 + :ivar exportable: Not supported in this version. Indicates if the private key can be exported. + :vartype exportable: bool + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :vartype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. + :vartype reuse_key: bool + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". + :vartype 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'}, + "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, "_models.JsonWebKeyType"]] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **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) + """ + :keyword exportable: Not supported in this version. Indicates if the private key can be + exported. + :paramtype exportable: bool + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". + :paramtype key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. + :paramtype reuse_key: bool + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". + :paramtype curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName + """ + super().__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(msrest.serialization.Model): +class KeyRestoreParameters(_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. - :type key_bundle_backup: bytes + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. + :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] + def __init__(self, *, key_bundle_backup: bytes, **kwargs): + """ + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. + :paramtype key_bundle_backup: bytes + """ + super().__init__(**kwargs) + self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". - :type algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param value: Required. - :type value: bytes + :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm + :ivar value: Required. + :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): + """ + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". + :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm + :keyword value: Required. + :paramtype value: bytes + """ + super().__init__(**kwargs) + self.algorithm = algorithm + self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. - :param key_ops: Json web key operations. For more information on possible key operations, see + :ivar 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: The attributes of a key managed by the key vault service. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :vartype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] + :ivar key_attributes: The attributes of a key managed by the key vault service. + :vartype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, + *, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :paramtype key_ops: list[str or ~azure.keyvault.v7_1.models.JsonWebKeyOperation] + :keyword key_attributes: The attributes of a key managed by the key vault service. + :paramtype key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.key_ops = key_ops + self.key_attributes = key_attributes + self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -762,59 +975,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_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_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 + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". + :vartype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm + :ivar digest: The digest used for signing. Required. + :vartype digest: bytes + :ivar signature: The signature to be verified. Required. + :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, + *, + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, **kwargs ): - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] + """ + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". + :paramtype algorithm: str or ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm + :keyword digest: The digest used for signing. Required. + :paramtype digest: bytes + :keyword signature: The signature to be verified. Required. + :paramtype signature: bytes + """ + super().__init__(**kwargs) + self.algorithm = algorithm + self.digest = digest + self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -824,157 +1049,14 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None - - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, 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. - """ - - #: Denotes a vault state in which deletion is an irreversible operation, without the possibility - #: for recovery. This level corresponds to no protection being available against a Delete - #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). - PURGEABLE = "Purgeable" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity - #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted - #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE = "Recoverable" - #: Denotes a vault and subscription state in which deletion is recoverable within retention - #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in - #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. - RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees - #: the recoverability of the deleted entity during the retention interval, unless a Purge - #: operation is requested, or the subscription is cancelled. - CUSTOMIZED_RECOVERABLE_PURGEABLE = "CustomizedRecoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level - #: guarantees the recoverability of the deleted entity during the retention interval and while the - #: subscription is still available. - CUSTOMIZED_RECOVERABLE = "CustomizedRecoverable" - #: Denotes a vault and subscription state in which deletion is recoverable, immediate and - #: permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot - #: be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the - #: recoverability of the deleted entity during the retention interval, and also reflects the fact - #: that the subscription itself cannot be cancelled. - CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" - -class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ - - #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. - P256 = "P-256" - #: The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. - P384 = "P-384" - #: The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. - P521 = "P-521" - #: The SECG SECP256K1 elliptic curve. - P256_K = "P-256K" - -class JsonWebKeyEncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ - - RSA_OAEP = "RSA-OAEP" - RSA_OAEP256 = "RSA-OAEP-256" - RSA1_5 = "RSA1_5" - -class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ - - ENCRYPT = "encrypt" - DECRYPT = "decrypt" - SIGN = "sign" - VERIFY = "verify" - WRAP_KEY = "wrapKey" - UNWRAP_KEY = "unwrapKey" - IMPORT_ENUM = "import" - -class JsonWebKeySignatureAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The signing/verification algorithm identifier. For more information on possible algorithm - types, see JsonWebKeySignatureAlgorithm. - """ - - #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. - PS256 = "PS256" - #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. - PS384 = "PS384" - #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. - PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. - RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. - RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. - RS512 = "RS512" - #: Reserved. - RSNULL = "RSNULL" - #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. - ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. - ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. - ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. - ES256_K = "ES256K" - -class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """JsonWebKey Key Type (kty), as defined in - https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - """ - - #: Elliptic Curve. - EC = "EC" - #: Elliptic Curve with a private key which is not exportable from the HSM. - EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). - RSA = "RSA" - #: RSA with a private key which is not exportable from the HSM. - RSA_HSM = "RSA-HSM" - #: Not supported in this version. Octet sequence (used to represent symmetric keys). - OCT = "oct" diff --git a/sdk/keyvault/azure-keyvault-keys/setup.py b/sdk/keyvault/azure-keyvault-keys/setup.py index bc99759005cd..aabc02475c3f 100644 --- a/sdk/keyvault/azure-keyvault-keys/setup.py +++ b/sdk/keyvault/azure-keyvault-keys/setup.py @@ -68,7 +68,6 @@ install_requires=[ "azure-core<2.0.0,>=1.24.0", "cryptography>=2.1.4", - "msrest>=0.7.1", "azure-common~=1.1", "six>=1.12.0" ], diff --git a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md index e240086943cf..fb2fe95e872f 100644 --- a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md @@ -9,6 +9,8 @@ ### Bugs Fixed ### Other Changes +- Updated minimum `azure-core` version to 1.24.0 +- Dropped `msrest` requirement ## 4.6.0 (2022-09-19) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/__init__.py index a6c1f9b7a792..f81543eeed02 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/__init__.py @@ -14,3 +14,7 @@ patch_sdk() except ImportError: pass + +from ._version import VERSION + +__version__ = VERSION diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_configuration.py index 4a4fcbedaa26..8d4e90f2c212 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_configuration.py @@ -8,31 +8,40 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential """ def __init__( self, + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -45,8 +54,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_key_vault_client.py index 1cdf3375cd00..6b86487bd5d1 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_key_vault_client.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from azure.core.credentials import TokenCredential class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -41,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -124,6 +126,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "TokenCredential", api_version=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any @@ -132,8 +135,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_operations_mixin.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_operations_mixin.py index f4385ca7860b..b90ab3c5eb38 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_operations_mixin.py @@ -8,39 +8,36 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import TYPE_CHECKING +from ._serialization import Serializer, Deserializer +from typing import Any, IO, Iterable, Optional, Union -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable, Optional +from azure.core.paging import ItemPaged - from azure.core.paging import ItemPaged +from . import models as _models class KeyVaultClientOperationsMixin(object): def backup_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -57,11 +54,10 @@ def backup_certificate( def backup_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -76,14 +72,14 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -102,24 +98,23 @@ def backup_key( def backup_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -144,24 +139,23 @@ def backup_secret( def backup_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -178,27 +172,30 @@ def backup_storage_account( def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -217,29 +214,32 @@ def create_certificate( def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -258,13 +258,12 @@ def create_key( def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -274,18 +273,22 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -304,25 +307,24 @@ def decrypt( def delete_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -341,21 +343,20 @@ def delete_certificate( def delete_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -374,24 +375,23 @@ def delete_certificate_contacts( def delete_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -410,25 +410,24 @@ def delete_certificate_issuer( def delete_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -447,11 +446,10 @@ def delete_certificate_operation( def delete_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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 @@ -459,14 +457,14 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -485,25 +483,24 @@ def delete_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -522,24 +519,23 @@ def delete_sas_definition( def delete_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -564,21 +560,20 @@ def delete_secret( def delete_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -597,13 +592,12 @@ def delete_storage_account( def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -615,18 +609,22 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -645,27 +643,26 @@ def encrypt( def get_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -684,21 +681,20 @@ def get_certificate( def get_certificate_contacts( self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -717,25 +713,24 @@ def get_certificate_contacts( def get_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -754,28 +749,26 @@ def get_certificate_issuer( def get_certificate_issuers( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -794,24 +787,23 @@ def get_certificate_issuers( def get_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -830,24 +822,23 @@ def get_certificate_operation( def get_certificate_policy( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -866,29 +857,27 @@ def get_certificate_policy( 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"] + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -907,26 +896,24 @@ def get_certificate_versions( def get_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -945,25 +932,24 @@ def get_certificates( def get_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -982,11 +968,10 @@ def get_deleted_certificate( def get_deleted_certificates( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -994,17 +979,16 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -1023,25 +1007,24 @@ def get_deleted_certificates( def get_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1060,11 +1043,10 @@ def get_deleted_key( def get_deleted_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -1073,16 +1055,15 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1101,27 +1082,26 @@ def get_deleted_keys( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1138,30 +1118,28 @@ def get_deleted_sas_definition( def get_deleted_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1178,24 +1156,23 @@ def get_deleted_sas_definitions( def get_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1220,26 +1197,24 @@ def get_deleted_secret( def get_deleted_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1264,24 +1239,23 @@ def get_deleted_secrets( def get_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1298,26 +1272,25 @@ def get_deleted_storage_account( def get_deleted_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1334,27 +1307,27 @@ def get_deleted_storage_accounts( def get_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1373,28 +1346,27 @@ def get_key( def get_key_versions( self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1413,11 +1385,10 @@ def get_key_versions( def get_keys( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1425,15 +1396,15 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1452,25 +1423,24 @@ def get_keys( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1489,28 +1459,25 @@ def get_sas_definition( def get_sas_definitions( self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1529,28 +1496,27 @@ def get_sas_definitions( def get_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1575,28 +1541,27 @@ def get_secret( def get_secret_versions( self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1621,26 +1586,25 @@ def get_secret_versions( def get_secrets( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1665,22 +1629,21 @@ def get_secrets( def get_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1699,23 +1662,22 @@ def get_storage_account( def get_storage_accounts( self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1734,12 +1696,11 @@ def get_storage_accounts( def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1747,16 +1708,20 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1775,12 +1740,11 @@ def import_certificate( def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: Union[_models.KeyImportParameters, IO], + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1788,16 +1752,20 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1816,28 +1784,31 @@ def import_key( def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1856,25 +1827,24 @@ def merge_certificate( def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1893,25 +1863,24 @@ def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements def purge_deleted_key( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -1930,25 +1899,24 @@ def purge_deleted_key( # pylint: disable=inconsistent-return-statements def purge_deleted_secret( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -1973,25 +1941,24 @@ def purge_deleted_secret( # pylint: disable=inconsistent-return-statements def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -2008,11 +1975,10 @@ def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statem def recover_deleted_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -2020,14 +1986,14 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2046,11 +2012,10 @@ def recover_deleted_certificate( def recover_deleted_key( self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + **kwargs: Any + ) -> _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. @@ -2058,14 +2023,14 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2084,28 +2049,27 @@ def recover_deleted_key( 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" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2122,24 +2086,23 @@ def recover_deleted_sas_definition( def recover_deleted_secret( self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2164,25 +2127,24 @@ def recover_deleted_secret( def recover_deleted_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2199,25 +2161,28 @@ def recover_deleted_storage_account( def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2236,24 +2201,27 @@ def regenerate_storage_account_key( def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: Union[_models.CertificateRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2270,11 +2238,10 @@ def restore_certificate( def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: Union[_models.KeyRestoreParameters, IO], + **kwargs: Any + ) -> _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, @@ -2288,14 +2255,18 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2314,24 +2285,27 @@ def restore_key( def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: Union[_models.SecretRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2356,24 +2330,27 @@ def restore_secret( def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: Union[_models.StorageRestoreParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2390,24 +2367,27 @@ def restore_storage_account( def set_certificate_contacts( self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + vault_base_url: str, + contacts: Union[_models.Contacts, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2426,27 +2406,30 @@ def set_certificate_contacts( def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2465,28 +2448,31 @@ def set_certificate_issuer( def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2505,28 +2491,31 @@ def set_sas_definition( def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: Union[_models.SecretSetParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2551,24 +2540,27 @@ def set_secret( def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2587,31 +2579,34 @@ def set_storage_account( def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2630,13 +2625,12 @@ def sign( def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -2644,18 +2638,22 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2674,31 +2672,34 @@ def unwrap_key( def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2717,27 +2718,30 @@ def update_certificate( def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2756,28 +2760,31 @@ def update_certificate_issuer( def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2796,27 +2803,30 @@ def update_certificate_operation( 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -2835,13 +2845,12 @@ def update_certificate_policy( def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2849,18 +2858,22 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -2879,28 +2892,31 @@ def update_key( def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -2919,31 +2935,34 @@ def update_sas_definition( def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -2968,25 +2987,28 @@ def update_secret( def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -3005,13 +3027,12 @@ def update_storage_account( def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3020,18 +3041,22 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -3050,13 +3075,12 @@ def verify( def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3066,18 +3090,22 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_serialization.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_serialization.py new file mode 100644 index 000000000000..240df16c57f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, 'read'): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding='utf-8-sig') + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if 'content-type' in headers: + content_type = headers['content-type'].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds()/3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + +try: + from datetime import timezone + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0 + } + + def __init__(self, classes=None): + self.serialize_type = { + 'iso-8601': Serializer.serialize_iso, + 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, + 'duration': Serializer.serialize_duration, + 'date': Serializer.serialize_date, + 'time': Serializer.serialize_time, + 'decimal': Serializer.serialize_decimal, + 'long': Serializer.serialize_long, + 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, + 'object': self.serialize_object, + '[]': self.serialize_iter, + '{}': self.serialize_dict + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data( + target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data( + target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == '': + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) + + + if is_xml_model_serialization: + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + xml_prefix = xml_desc.get('prefix', None) + xml_ns = xml_desc.get('ns', None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if 'name' not in getattr(orig_attr, '_xml_map', {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node( + xml_name, + xml_prefix, + xml_ns + ) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format( + attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip('[]{}') + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback( + SerializationError, "Unable to build a model: "+str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [ + self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" + for d + in data + ] + if not kwargs.get('skip_quote', False): + data = [ + quote(str(d), safe='') + for d + in data + ] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ['[str]']: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type]( + data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback( + SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == 'str': + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ['' if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if 'xml' in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get('xml', {}) + xml_name = xml_desc.get('name') + if not xml_name: + xml_name = serialization_ctxt['key'] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node( + node_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data( + value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if 'xml' in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt['xml'] + xml_name = xml_desc['name'] + + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object( + value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object( + obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode('ascii') + return encoded.strip('=').replace('+', '-').replace('/', '_') + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], utc.tm_mday, + Serializer.months[utc.tm_mon], utc.tm_year, + utc.tm_hour, utc.tm_min, utc.tm_sec) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + if microseconds: + microseconds = '.'+microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + microseconds + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + return working_data.get(key) + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + + # Look for a children + is_iter_type = attr_desc['type'].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + )) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + + valid_date = re.compile( + r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' + r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + + def __init__(self, classes=None): + self.deserialize_type = { + 'iso-8601': Deserializer.deserialize_iso, + 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, + 'duration': Deserializer.deserialize_duration, + 'date': Deserializer.deserialize_date, + 'time': Deserializer.deserialize_time, + 'decimal': Deserializer.deserialize_decimal, + 'long': Deserializer.deserialize_long, + 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, + 'object': self.deserialize_object, + '[]': self.deserialize_iter, + '{}': self.deserialize_dict + } + self.deserialize_expected_types = { + 'duration': (isodate.Duration, datetime.timedelta), + 'iso-8601': (datetime.datetime) + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [ + rest_key_extractor, + xml_key_extractor + ] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, '_validation', {}).items() + if config.get('constant')] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig['type'] + internal_data_type = local_type.strip('[]{}') + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr( + data, + attr, + self._deserialize(local_type, value) + ) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == '': + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip('[]{}') + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ("Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning( + msg, + found_value, + key_extractor, + attr + ) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc['type']) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) + for desc in attribute_map.values() if desc['key'] != ''} + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + #Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text(), + raw_data.headers + ) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, '_content_consumed'): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text, + raw_data.headers + ) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, '_subtype_map', {}) + try: + readonly = [k for k, v in response._validation.items() + if v.get('readonly')] + const = [k for k, v in response._validation.items() + if v.get('constant')] + kwargs = {k: v for k, v in attrs.items() + if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format( + kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( + iter_type, + type(attr) + )) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, 'str') + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object( + value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object( + obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return '' + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == 'bool': + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ['true', '1']: + return True + elif attr.lower() in ['false', '0']: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == 'str': + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], + tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split('.') + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_configuration.py index 618024f0b97c..08735390ee1c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_configuration.py @@ -8,26 +8,39 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class KeyVaultClientConfiguration(Configuration): """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ def __init__( self, + credential: "AsyncTokenCredential", **kwargs # type: Any ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(KeyVaultClientConfiguration, self).__init__(**kwargs) + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'azure-keyvault/{}'.format(VERSION)) self._configure(**kwargs) @@ -39,8 +52,10 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_key_vault_client.py index 3c99df10b077..0d9cfef31d76 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_key_vault_client.py @@ -9,17 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from ._operations_mixin import KeyVaultClientOperationsMixin +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -37,6 +40,9 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str :param profile: A profile definition, from KnownProfiles to dict. @@ -120,6 +126,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli def __init__( self, + credential: "AsyncTokenCredential", api_version: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any @@ -128,8 +135,8 @@ def __init__( base_url = '{vaultBaseUrl}' else: raise ValueError("API version {} is not available".format(api_version)) - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = KeyVaultClientConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_operations_mixin.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_operations_mixin.py index 06265ed48fd3..23cce15b2d02 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_operations_mixin.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/aio/_operations_mixin.py @@ -8,11 +8,13 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Optional +from .._serialization import Serializer, Deserializer +from typing import Any, AsyncIterable, IO, Optional, Union from azure.core.async_paging import AsyncItemPaged +from .. import models as _models + class KeyVaultClientOperationsMixin(object): @@ -21,21 +23,21 @@ async def backup_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.BackupCertificateResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_certificate') if api_version == '7.0': @@ -55,7 +57,7 @@ async def backup_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.BackupKeyResult": + ) -> _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 @@ -70,14 +72,14 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_key') if api_version == '2016-10-01': @@ -99,20 +101,20 @@ async def backup_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.BackupSecretResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_secret') if api_version == '2016-10-01': @@ -140,20 +142,20 @@ async def backup_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.BackupStorageResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('backup_storage_account') if api_version == '7.0': @@ -172,24 +174,28 @@ async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_certificate') if api_version == '2016-10-01': @@ -210,26 +216,30 @@ async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('create_key') if api_version == '2016-10-01': @@ -251,9 +261,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -263,18 +273,22 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('decrypt') if api_version == '2016-10-01': @@ -296,21 +310,21 @@ async def delete_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate') if api_version == '2016-10-01': @@ -331,18 +345,18 @@ async def delete_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_contacts') if api_version == '2016-10-01': @@ -364,20 +378,20 @@ async def delete_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_issuer') if api_version == '2016-10-01': @@ -399,21 +413,21 @@ async def delete_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_certificate_operation') if api_version == '2016-10-01': @@ -435,7 +449,7 @@ async def delete_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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 @@ -443,14 +457,14 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_key') if api_version == '2016-10-01': @@ -473,20 +487,20 @@ async def delete_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_sas_definition') if api_version == '2016-10-01': @@ -508,20 +522,20 @@ async def delete_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_secret') if api_version == '2016-10-01': @@ -549,17 +563,17 @@ async def delete_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('delete_storage_account') if api_version == '2016-10-01': @@ -581,9 +595,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -595,18 +609,22 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('encrypt') if api_version == '2016-10-01': @@ -629,22 +647,22 @@ async def get_certificate( certificate_name: str, certificate_version: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate') if api_version == '2016-10-01': @@ -665,18 +683,18 @@ async def get_certificate_contacts( self, vault_base_url: str, **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_contacts') if api_version == '2016-10-01': @@ -698,21 +716,21 @@ async def get_certificate_issuer( vault_base_url: str, issuer_name: str, **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuer') if api_version == '2016-10-01': @@ -734,24 +752,24 @@ def get_certificate_issuers( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_issuers') if api_version == '2016-10-01': @@ -773,20 +791,20 @@ async def get_certificate_operation( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_operation') if api_version == '2016-10-01': @@ -808,20 +826,20 @@ async def get_certificate_policy( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_policy') if api_version == '2016-10-01': @@ -844,25 +862,24 @@ def get_certificate_versions( certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificate_versions') if api_version == '2016-10-01': @@ -884,23 +901,22 @@ def get_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_certificates') if api_version == '2016-10-01': @@ -922,21 +938,21 @@ async def get_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificate') if api_version == '2016-10-01': @@ -958,7 +974,7 @@ def get_deleted_certificates( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -966,17 +982,17 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_certificates') if api_version == '2016-10-01': @@ -998,21 +1014,21 @@ async def get_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.DeletedKeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_key') if api_version == '2016-10-01': @@ -1034,7 +1050,7 @@ def get_deleted_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1043,17 +1059,16 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_keys') if api_version == '2016-10-01': @@ -1076,22 +1091,22 @@ async def get_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definition') if api_version == '7.0': @@ -1112,25 +1127,25 @@ def get_deleted_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_sas_definitions') if api_version == '7.0': @@ -1150,20 +1165,20 @@ async def get_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.DeletedSecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secret') if api_version == '2016-10-01': @@ -1191,23 +1206,21 @@ def get_deleted_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_secrets') if api_version == '2016-10-01': @@ -1235,20 +1248,20 @@ async def get_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.DeletedStorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_account') if api_version == '7.0': @@ -1268,23 +1281,23 @@ def get_deleted_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_deleted_storage_accounts') if api_version == '7.0': @@ -1305,22 +1318,23 @@ async def get_key( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key') if api_version == '2016-10-01': @@ -1343,24 +1357,23 @@ def get_key_versions( key_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_key_versions') if api_version == '2016-10-01': @@ -1382,7 +1395,7 @@ def get_keys( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -1390,16 +1403,15 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_keys') if api_version == '2016-10-01': @@ -1422,20 +1434,20 @@ async def get_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definition') if api_version == '2016-10-01': @@ -1458,23 +1470,22 @@ def get_sas_definitions( storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_sas_definitions') if api_version == '2016-10-01': @@ -1497,23 +1508,23 @@ async def get_secret( secret_name: str, secret_version: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret') if api_version == '2016-10-01': @@ -1542,23 +1553,23 @@ def get_secret_versions( secret_name: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secret_versions') if api_version == '2016-10-01': @@ -1586,22 +1597,22 @@ def get_secrets( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_secrets') if api_version == '2016-10-01': @@ -1629,18 +1640,18 @@ async def get_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_account') if api_version == '2016-10-01': @@ -1662,20 +1673,20 @@ def get_storage_accounts( vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('get_storage_accounts') if api_version == '2016-10-01': @@ -1696,9 +1707,9 @@ async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -1706,16 +1717,20 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_certificate') if api_version == '2016-10-01': @@ -1736,9 +1751,9 @@ async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -1746,16 +1761,20 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('import_key') if api_version == '2016-10-01': @@ -1776,25 +1795,29 @@ async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('merge_certificate') if api_version == '2016-10-01': @@ -1823,14 +1846,14 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_certificate') if api_version == '2016-10-01': @@ -1859,14 +1882,14 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_key') if api_version == '2016-10-01': @@ -1895,14 +1918,14 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_secret') if api_version == '2016-10-01': @@ -1937,14 +1960,14 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('purge_deleted_storage_account') if api_version == '7.0': @@ -1964,7 +1987,7 @@ async def recover_deleted_certificate( vault_base_url: str, certificate_name: str, **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -1972,14 +1995,14 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_certificate') if api_version == '2016-10-01': @@ -2001,7 +2024,7 @@ async def recover_deleted_key( vault_base_url: str, key_name: str, **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2009,14 +2032,14 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_key') if api_version == '2016-10-01': @@ -2039,23 +2062,23 @@ async def recover_deleted_sas_definition( storage_account_name: str, sas_definition_name: str, **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_sas_definition') if api_version == '7.0': @@ -2075,20 +2098,20 @@ async def recover_deleted_secret( vault_base_url: str, secret_name: str, **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_secret') if api_version == '2016-10-01': @@ -2116,21 +2139,21 @@ async def recover_deleted_storage_account( vault_base_url: str, storage_account_name: str, **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('recover_deleted_storage_account') if api_version == '7.0': @@ -2149,22 +2172,26 @@ async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('regenerate_storage_account_key') if api_version == '2016-10-01': @@ -2184,22 +2211,26 @@ async def regenerate_storage_account_key( async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_certificate') if api_version == '7.0': @@ -2217,9 +2248,9 @@ async def restore_certificate( async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -2233,14 +2264,18 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_key') if api_version == '2016-10-01': @@ -2260,22 +2295,26 @@ async def restore_key( async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. - :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_secret') if api_version == '2016-10-01': @@ -2301,22 +2340,26 @@ async def restore_secret( async def restore_storage_account( self, vault_base_url: str, - parameters: "_models.StorageRestoreParameters", + parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('restore_storage_account') if api_version == '7.0': @@ -2334,22 +2377,26 @@ async def restore_storage_account( async def set_certificate_contacts( self, vault_base_url: str, - contacts: "_models.Contacts", + contacts: Union[_models.Contacts, IO], **kwargs: Any - ) -> "_models.Contacts": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_contacts') if api_version == '2016-10-01': @@ -2370,24 +2417,28 @@ async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: Union[_models.CertificateIssuerSetParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_certificate_issuer') if api_version == '2016-10-01': @@ -2409,24 +2460,28 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_sas_definition') if api_version == '2016-10-01': @@ -2447,25 +2502,29 @@ async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_secret') if api_version == '2016-10-01': @@ -2492,21 +2551,25 @@ async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('set_storage_account') if api_version == '2016-10-01': @@ -2528,27 +2591,31 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('sign') if api_version == '2016-10-01': @@ -2570,9 +2637,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -2580,18 +2647,22 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('unwrap_key') if api_version == '2016-10-01': @@ -2613,27 +2684,31 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate') if api_version == '2016-10-01': @@ -2654,24 +2729,28 @@ async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_issuer') if api_version == '2016-10-01': @@ -2692,25 +2771,29 @@ async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_operation') if api_version == '2016-10-01': @@ -2731,24 +2814,28 @@ async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :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) + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_certificate_policy') if api_version == '2016-10-01': @@ -2770,9 +2857,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -2780,18 +2867,22 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_key') if api_version == '2016-10-01': @@ -2813,24 +2904,28 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_sas_definition') if api_version == '2016-10-01': @@ -2852,27 +2947,31 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_secret') if api_version == '2016-10-01': @@ -2899,22 +2998,26 @@ async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('update_storage_account') if api_version == '2016-10-01': @@ -2936,9 +3039,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -2947,18 +3050,22 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('verify') if api_version == '2016-10-01': @@ -2980,9 +3087,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -2992,18 +3099,22 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('wrap_key') if api_version == '2016-10-01': diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_configuration.py index ea5a71f153da..0021ca88647e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_key_vault_client.py index 84f121203cc4..aaa06cdeaa8e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_metadata.json b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_metadata.json index 406f3aaab330..9a33701dda24 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_metadata.json +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,822 +65,889 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation:\n ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters\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" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters\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" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_vendor.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_configuration.py index 7bf8c5316293..3130095b65ea 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", "2016-10-01") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_key_vault_client.py index 281ae11c1dac..5515751f6d64 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2016-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py index 18cd4b2e2be5..697635d957c6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,263 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_key_request, build_backup_secret_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_secret_request, build_regenerate_storage_account_key_request, build_restore_key_request, build_restore_secret_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_key_request, + build_backup_secret_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_secret_request, + build_regenerate_storage_account_key_request, + build_restore_key_request, + build_restore_secret_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +270,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +411,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_key( @@ -239,9 +543,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +553,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +599,167 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +773,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,54 +800,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -549,33 +864,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -590,64 +896,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -661,59 +974,214 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def encrypt( @@ -721,9 +1189,9 @@ async def encrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -735,29 +1203,45 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -765,35 +1249,110 @@ async def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def decrypt( @@ -801,9 +1360,9 @@ async def decrypt( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -813,29 +1372,45 @@ async def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -843,35 +1418,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def sign( @@ -879,38 +1523,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -918,35 +1578,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def verify( @@ -954,9 +1687,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -965,29 +1698,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -995,35 +1744,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Wraps a symmetric key using a specified key. - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def wrap_key( @@ -1031,9 +1855,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1043,29 +1867,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1073,35 +1913,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unwrap_key( @@ -1109,9 +2020,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1119,29 +2030,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1149,43 +2076,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1194,55 +2119,58 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1256,96 +2184,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1353,60 +2274,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1414,190 +2335,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace_async + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -1605,38 +2674,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1644,164 +2729,166 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1815,91 +2902,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1913,87 +2994,83 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + if not next_link: - else: - request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2007,95 +3084,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2103,306 +3175,376 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2416,336 +3558,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2759,371 +3960,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3131,129 +4627,144 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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) + :return: An iterator like instance of either CertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3267,158 +4778,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3426,38 +5080,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3465,379 +5135,539 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3845,55 +5675,59 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: - else: - request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=next_link, + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3907,96 +5741,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4004,60 +5833,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4065,115 +5896,121 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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) + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4187,414 +6024,629 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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) + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4608,155 +6660,215 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_sas_definition( @@ -4764,35 +6876,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -4800,35 +6928,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_sas_definition( @@ -4836,35 +7027,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -4872,32 +7079,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/__init__.py index 5f3be613a755..e95cdc3af87a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/__init__.py @@ -6,264 +6,186 @@ # 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 BackupKeyResult - from ._models_py3 import BackupSecretResult - 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 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 DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 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 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 ._models_py3 import Action +from ._models_py3 import AdministratorDetails +from ._models_py3 import Attributes +from ._models_py3 import BackupKeyResult +from ._models_py3 import BackupSecretResult +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 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 DeletedKeyBundle +from ._models_py3 import DeletedKeyItem +from ._models_py3 import DeletedKeyListResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 SubjectAlternativeNames +from ._models_py3 import Trigger +from ._models_py3 import X509CertificateProperties -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupKeyResult', - 'BackupSecretResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - 'DeletedCertificateBundle', - 'DeletedCertificateItem', - 'DeletedCertificateListResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'IssuerAttributes', - 'IssuerBundle', - 'IssuerCredentials', - 'IssuerParameters', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', - 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', - 'KeyVerifyParameters', - 'KeyVerifyResult', - 'LifetimeAction', - 'OrganizationDetails', - 'PendingCertificateSigningRequestResult', - 'SasDefinitionAttributes', - 'SasDefinitionBundle', - 'SasDefinitionCreateParameters', - 'SasDefinitionItem', - 'SasDefinitionListResult', - 'SasDefinitionUpdateParameters', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'StorageAccountAttributes', - 'StorageAccountCreateParameters', - 'StorageAccountItem', - 'StorageAccountRegenerteKeyParameters', - 'StorageAccountUpdateParameters', - 'StorageBundle', - 'StorageListResult', - 'SubjectAlternativeNames', - 'Trigger', - 'X509CertificateProperties', - 'ActionType', - 'DeletionRecoveryLevel', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupKeyResult", + "BackupSecretResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "DeletedCertificateBundle", + "DeletedCertificateItem", + "DeletedCertificateListResult", + "DeletedKeyBundle", + "DeletedKeyItem", + "DeletedKeyListResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "IssuerAttributes", + "IssuerBundle", + "IssuerCredentials", + "IssuerParameters", + "JsonWebKey", + "KeyAttributes", + "KeyBundle", + "KeyCreateParameters", + "KeyImportParameters", + "KeyItem", + "KeyListResult", + "KeyOperationResult", + "KeyOperationsParameters", + "KeyProperties", + "KeyRestoreParameters", + "KeySignParameters", + "KeyUpdateParameters", + "KeyVaultError", + "KeyVerifyParameters", + "KeyVerifyResult", + "LifetimeAction", + "OrganizationDetails", + "PendingCertificateSigningRequestResult", + "SasDefinitionAttributes", + "SasDefinitionBundle", + "SasDefinitionCreateParameters", + "SasDefinitionItem", + "SasDefinitionListResult", + "SasDefinitionUpdateParameters", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "StorageAccountAttributes", + "StorageAccountCreateParameters", + "StorageAccountItem", + "StorageAccountRegenerteKeyParameters", + "StorageAccountUpdateParameters", + "StorageBundle", + "StorageListResult", + "SubjectAlternativeNames", + "Trigger", + "X509CertificateProperties", + "ActionType", + "DeletionRecoveryLevel", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_key_vault_client_enums.py index 5c095aa3ecb5..81cad1a34048 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -37,9 +36,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: deletion. RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -50,17 +49,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. SECP256_K1 = "SECP256K1" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -69,7 +68,8 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ @@ -86,9 +86,9 @@ class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, ES512 = "ES512" ECDSA256 = "ECDSA256" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JsonWebKey key type (kty). - """ + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JsonWebKey key type (kty).""" EC = "EC" EC_HSM = "EC-HSM" @@ -96,7 +96,9 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA_HSM = "RSA-HSM" OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models.py deleted file mode 100644 index c1756054d9ee..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models.py +++ /dev/null @@ -1,3452 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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 CertificateAttributes(Attributes): - """The certificate management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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.v2016_10_01.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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.v2016_10_01.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v2016_10_01.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v2016_10_01.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - """ - 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 CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - """ - 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.v2016_10_01.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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.v2016_10_01.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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 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.v2016_10_01.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Type of certificate to be requested from the issuer provider. - :vartype certificate_type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Type of certificate to be requested from the issuer provider. - :paramtype certificate_type: str - """ - super(IssuerParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.certificate_type = kwargs.get('certificate_type', None) - - -class JsonWebKey(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". - :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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.v2016_10_01.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The key type. - :vartype key_type: str - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The key type. - :paramtype key_type: str - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - """ - 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) - - -class KeyRestoreParameters(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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.v2016_10_01.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v2016_10_01.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v2016_10_01.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v2016_10_01.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -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. - - :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. - :vartype parameters: dict[str, str] - :ivar attributes: The SAS definition attributes. - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.parameters = None - self.attributes = None - self.tags = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _validation = { - 'parameters': {'required': True}, - } - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.parameters = kwargs['parameters'] - self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) - self.tags = kwargs.get('tags', None) - - -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. - - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :ivar parameters: Sas definition update metadata in the form of key-value pairs. - :vartype parameters: dict[str, str] - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_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] - """ - - _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword parameters: Sas definition update metadata in the form of key-value pairs. - :paramtype parameters: dict[str, str] - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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.v2016_10_01.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype 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 - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(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. - - :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: A set of 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 StorageAccountRegenerteKeyParameters(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_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] - """ - - _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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 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. - - :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.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] - """ - - _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 StorageListResult(msrest.serialization.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.v2016_10_01.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 SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: - ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models_py3.py index d6089212548c..92798f86dd32 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -152,24 +148,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -179,20 +171,16 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -214,24 +202,24 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and + "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -250,11 +238,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -270,55 +258,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -330,28 +318,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -360,22 +348,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :ivar base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -384,20 +372,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -405,14 +393,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. Base64 encoded representation of the certificate - object to import. This certificate needs to contain the private key. + :keyword base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -421,10 +409,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -432,7 +420,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -442,16 +430,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -459,12 +443,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -477,32 +461,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -513,27 +493,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials @@ -542,14 +522,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -563,19 +543,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -588,38 +568,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -629,19 +609,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -654,72 +634,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -730,7 +706,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -747,30 +723,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -780,7 +756,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -795,7 +771,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -807,40 +783,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -864,28 +835,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -904,7 +875,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -914,28 +885,28 @@ def __init__( self.attributes = attributes -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -944,16 +915,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -965,18 +936,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -986,13 +952,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1004,30 +970,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1043,12 +1004,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1060,54 +1021,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1122,7 +1083,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1136,25 +1097,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1165,7 +1126,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1173,13 +1134,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1192,27 +1153,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1221,7 +1178,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1229,21 +1186,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1252,10 +1209,10 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1271,7 +1228,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1286,26 +1243,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1315,19 +1272,19 @@ def __init__( :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1336,7 +1293,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1344,21 +1301,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1367,10 +1324,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1386,7 +1343,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1401,26 +1358,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1430,19 +1387,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1455,27 +1412,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1488,7 +1441,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1499,27 +1452,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1532,10 +1485,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1558,7 +1511,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1576,32 +1529,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1615,19 +1568,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1636,7 +1589,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1646,22 +1599,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -1671,12 +1624,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -1693,7 +1646,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1710,27 +1663,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -1741,7 +1694,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -1749,13 +1702,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1768,27 +1721,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -1802,30 +1751,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -1839,33 +1784,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -1883,24 +1823,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -1913,7 +1853,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -1921,7 +1861,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -1931,29 +1871,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -1964,17 +1898,11 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - certificate_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, certificate_type: Optional[str] = None, **kwargs): """ :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. @@ -1982,18 +1910,18 @@ def __init__( :keyword certificate_type: Type of certificate to be requested from the issuer provider. :paramtype certificate_type: str """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str - :ivar kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :ivar kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and + "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2017,8 +1945,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2027,29 +1955,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2061,7 +1989,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2069,8 +1997,8 @@ def __init__( """ :keyword kid: Key identifier. :paramtype kid: str - :keyword kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", - "RSA-HSM", "oct". + :keyword kty: JsonWebKey key type (kty). Known values are: "EC", "EC-HSM", "RSA", "RSA-HSM", + and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2094,15 +2022,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :paramtype crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2138,25 +2066,25 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2175,17 +2103,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2193,40 +2121,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "SECP256K1". :vartype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2234,13 +2162,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "SECP256K1". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "SECP256K1". :paramtype curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2249,59 +2177,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2314,27 +2242,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2346,68 +2270,58 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. @@ -2421,10 +2335,10 @@ class KeyProperties(msrest.serialization.Model): """ _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'}, + "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"}, } def __init__( @@ -2446,52 +2360,47 @@ def __init__( :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size self.reuse_key = reuse_key -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -2499,37 +2408,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -2537,21 +2440,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2561,16 +2464,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -2580,75 +2483,72 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ECDSA256". :vartype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ECDSA256". :paramtype algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2658,24 +2558,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -2685,16 +2581,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -2702,12 +2594,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v2016_10_01.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -2717,15 +2609,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -2734,12 +2626,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2749,24 +2641,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -2780,33 +2668,28 @@ class SasDefinitionAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -2819,33 +2702,29 @@ class SasDefinitionBundle(msrest.serialization.Model): :vartype parameters: dict[str, str] :ivar attributes: The SAS definition attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'parameters': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "parameters": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "parameters": {"key": "parameters", "type": "{str}"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.parameters = None @@ -2853,53 +2732,53 @@ def __init__( self.tags = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :ivar parameters: Sas definition creation metadata in the form of key-value pairs. Required. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'parameters': {'required': True}, + "parameters": {"required": True}, } _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Dict[str, str], - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword parameters: Required. Sas definition creation metadata in the form of key-value pairs. + :keyword parameters: Sas definition creation metadata in the form of key-value pairs. Required. :paramtype parameters: dict[str, str] :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -2910,38 +2789,34 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :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. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None self.tags = None -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2954,48 +2829,44 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :ivar parameters: Sas definition update metadata in the form of key-value pairs. :vartype parameters: dict[str, str] :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "parameters": {"key": "parameters", "type": "{str}"}, + "sas_definition_attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, parameters: Optional[Dict[str, str]] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3005,10 +2876,10 @@ def __init__( :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags @@ -3032,24 +2903,24 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", and "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3068,11 +2939,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3085,27 +2956,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3113,62 +2980,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3177,14 +3034,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3193,48 +3050,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3243,16 +3100,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3266,66 +3123,61 @@ class StorageAccountAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3335,27 +3187,27 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3364,7 +3216,7 @@ def __init__( self.tags = tags -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -3375,69 +3227,60 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None self.tags = None -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -3449,16 +3292,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -3467,7 +3310,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3481,10 +3324,10 @@ def __init__( :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -3492,7 +3335,7 @@ def __init__( self.tags = tags -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -3509,37 +3352,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :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. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -3549,7 +3388,7 @@ def __init__( self.tags = None -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3562,27 +3401,23 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -3594,9 +3429,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -3615,13 +3450,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -3634,20 +3469,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -3658,12 +3489,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -3679,15 +3510,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -3695,8 +3526,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -3713,7 +3544,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_key_vault_client_operations.py index 2f19f8e0841e..74c50773e8a5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_key_vault_client_operations.py @@ -6,2396 +6,1898 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificates_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" - # Construct URL + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore - + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2403,71 +1905,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2475,67 +2046,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2543,29 +2188,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2573,169 +2234,167 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :type key_name: str :param key_version: Adding the version parameter retrieves a specific version of a key. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2749,34 +2408,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -2784,53 +2435,57 @@ def get_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.KeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2844,34 +2499,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2886,65 +2531,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -2958,70 +2609,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.KeyBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3033,29 +2838,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3063,46 +2884,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3112,29 +3007,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3142,75 +3053,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3218,46 +3213,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3266,29 +3333,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3296,46 +3379,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3345,29 +3502,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3375,46 +3548,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. - if cls: - return cls(pipeline_response, deserialized, {}) + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ - return deserialized + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyOperationResult: + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3422,29 +3665,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3452,44 +3711,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3498,54 +3754,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedKeyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3559,160 +3818,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -3720,232 +3969,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -3953,165 +4363,166 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4125,91 +4536,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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.v2016_10_01.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4223,88 +4628,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4318,407 +4717,462 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4732,341 +5186,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v2016_10_01.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5080,377 +5587,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v2016_10_01.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5458,129 +6250,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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.v2016_10_01.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5594,200 +6400,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -5795,385 +6757,539 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Updates a certificate operation. - get_certificate.metadata = {'url': "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. :type certificate_operation: - ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter + ~azure.keyvault.v2016_10_01.models.CertificateOperationUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def get_deleted_certificates( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedCertificateListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6181,55 +7297,58 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 DeletedCertificateListResult or the result of + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6243,160 +7362,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6404,115 +7517,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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.v2016_10_01.models.StorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6526,420 +7644,628 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.StorageBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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.v2016_10_01.models.SasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6953,194 +8279,267 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -7148,72 +8547,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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.v2016_10_01.models.SasDefinitionBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v2016_10_01.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -7221,32 +8698,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_configuration.py index 1a95df0f5541..07502e68f9a8 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_key_vault_client.py index 1ff950f493ad..278870c0c99f 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_metadata.json b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_metadata.json index ccc1f8cc1b7d..52a7aea7ec22 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_metadata.json +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,954 +65,1032 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "create_key" : { "sync": { - "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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\"\"\"" + "signature": "def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters\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, parameters" + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyCreateParameters, IO],\n **kwargs: Any\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. Required.\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. Required.\n:type key_name: str\n:param parameters: The parameters to create a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_key" : { "sync": { - "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n parameters, # type: \"_models.KeyImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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\"\"\"" + "signature": "def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: \"_models.KeyImportParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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 parameters: The parameters to import a key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters\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, parameters" + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n parameters: Union[_models.KeyImportParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the\nclient.\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. Required.\n:type vault_base_url: str\n:param key_name: Name for the imported key. Required.\n:type key_name: str\n:param parameters: The parameters to import a key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to delete. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.KeyUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.KeyBundle\"\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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\"\"\"" + "signature": "def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyUpdateParameters\",\n **kwargs: Any\n) -\u003e \"_models.KeyBundle\":\n", - "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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 parameters: The parameters of the key to update.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters\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, parameters" + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyUpdateParameters, IO],\n **kwargs: Any\n) -\u003e _models.KeyBundle:\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any\nkey 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. Required.\n:type vault_base_url: str\n:param key_name: The name of key to update. Required.\n:type key_name: str\n:param key_version: The version of the key to update. Required.\n:type key_version: str\n:param parameters: The parameters of the key to update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key to get. Required.\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 Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, key_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.KeyItem\"]:\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. Required.\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. Default value is None.\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 KeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "restore_key" : { "sync": { - "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.KeyRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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\"\"\"" + "signature": "def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: \"_models.KeyRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the key.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters\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, parameters" + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n parameters: Union[_models.KeyRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the key. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "encrypt" : { "sync": { - "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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\nkey-reference 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 parameters: The parameters for the encryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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\nkey-reference 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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the encryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "decrypt" : { "sync": { - "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the decryption operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the decryption operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "sign" : { "sync": { - "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeySignParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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\"\"\"" + "signature": "def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeySignParameters\",\n **kwargs: Any\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 parameters: The parameters for the signing operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters\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, parameters" + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeySignParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the signing operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "verify" : { "sync": { - "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n parameters, # type: \"_models.KeyVerifyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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\"\"\"" + "signature": "def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyVerifyParameters\",\n **kwargs: Any\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 parameters: The parameters for verify operations.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters\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, parameters" + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyVerifyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for verify operations. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for wrap operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for wrap operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.KeyOperationsParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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\"\"\"" + "signature": "def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: \"_models.KeyOperationsParameters\",\n **kwargs: Any\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 parameters: The parameters for the key operation.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters\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, parameters" + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n parameters: Union[_models.KeyOperationsParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\n:type key_name: str\n:param key_version: The version of the key. Required.\n:type key_version: str\n:param parameters: The parameters for the key operation. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedKeyItem\"]:\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. Required.\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. Default value is None.\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 DeletedKeyItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "purge_deleted_key" : { "sync": { - "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_key( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param key_name: The name of the key. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param key_name: The name of the deleted key. Required.\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, **kwargs" + } }, "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters\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, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters\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, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters\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, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "set_certificate_contacts" : { "sync": { - "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contacts, # type: \"_models.Contacts\"\n **kwargs # type: Any\n):\n # type: (...) -\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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\"\"\"" + "signature": "def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: \"_models.Contacts\",\n **kwargs: Any\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 contacts: The contacts for the key vault certificate.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts\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, contacts" + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contacts: Union[_models.Contacts, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param contacts: The contacts for the key vault certificate. Is either a model type or a IO\n type. Required.\n:type contacts: ~azure.keyvault.v7_0.models.Contacts or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, contacts, **kwargs" + } }, "get_certificate_contacts" : { "sync": { - "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "delete_certificate_contacts" : { "sync": { - "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs: Any\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. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateIssuerItem\"]:\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. Required.\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. Default value is None.\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 CertificateIssuerItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "set_certificate_issuer" : { "sync": { - "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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\"\"\"" + "signature": "def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerSetParameters\",\n **kwargs: Any\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 parameter: Certificate issuer set parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters\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, parameter" + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer set parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "update_certificate_issuer" : { "sync": { - "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n parameter, # type: \"_models.CertificateIssuerUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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\"\"\"" + "signature": "def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: \"_models.CertificateIssuerUpdateParameters\",\n **kwargs: Any\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 parameter: Certificate issuer update parameter.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters\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, parameter" + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n parameter: Union[_models.CertificateIssuerUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\n:type issuer_name: str\n:param parameter: Certificate issuer update parameter. Is either a model type or a IO type.\n Required.\n:type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameter, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer. Required.\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, **kwargs" + } }, "create_certificate" : { "sync": { - "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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\"\"\"" + "signature": "def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters\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, parameters" + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to create a certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "import_certificate" : { "sync": { - "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateImportParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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\"\"\"" + "signature": "def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateImportParameters\",\n **kwargs: Any\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 parameters: The parameters to import the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters\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, parameters" + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateImportParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to import the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.CertificateItem\"]:\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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. Default value is None.\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 CertificateItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, certificate_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" }, "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: Any\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" + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Union[_models.CertificatePolicy, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate. Is either a model type or a IO type.\n Required.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, certificate_policy, **kwargs" + } }, "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 parameters, # type: \"_models.CertificateUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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\"\"\"" + "signature": "def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: \"_models.CertificateUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for certificate update.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters\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, parameters" + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n parameters: Union[_models.CertificateUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault. Required.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. Required.\n:type certificate_version: str\n:param parameters: The parameters for certificate update. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" }, "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: Any\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" + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault. Required.\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. Required.\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, **kwargs" + } }, "update_certificate_operation" : { "sync": { - "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_operation, # type: \"_models.CertificateOperationUpdateParameter\"\n **kwargs # type: Any\n):\n # type: (...) -\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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\"\"\"" + "signature": "def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: \"_models.CertificateOperationUpdateParameter\",\n **kwargs: Any\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 certificate_operation: The certificate operation response.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter\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_operation" + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param certificate_operation: The certificate operation response. Is either a model type or a\n IO type. Required.\n:type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or\n IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_operation, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "merge_certificate" : { "sync": { - "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n parameters, # type: \"_models.CertificateMergeParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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\"\"\"" + "signature": "def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: \"_models.CertificateMergeParameters\",\n **kwargs: Any\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 parameters: The parameters to merge certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters\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, parameters" + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n parameters: Union[_models.CertificateMergeParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\n:type certificate_name: str\n:param parameters: The parameters to merge certificate. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "restore_certificate" : { "sync": { - "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.CertificateRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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\"\"\"" + "signature": "def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: \"_models.CertificateRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the certificate.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters\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, parameters" + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n parameters: Union[_models.CertificateRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the certificate. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedCertificateItem\"]:\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. Required.\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. Default value is None.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned. Default value is None.\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 DeletedCertificateItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, include_pending, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "purge_deleted_certificate" : { "sync": { - "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate. Required.\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, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\"\"\"" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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" + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.StorageAccountItem\"]:\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. Required.\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. Default value is None.\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 StorageAccountItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedStorageAccountItem\"]:\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. Required.\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. Default value is None.\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 DeletedStorageAccountItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "purge_deleted_storage_account" : { "sync": { - "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "restore_storage_account" : { "sync": { - "signature": "def restore_storage_account(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.StorageRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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\"\"\"" + "signature": "def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: \"_models.StorageRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters\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, parameters" + "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n parameters: Union[_models.StorageRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the storage account. Is either a model type or a\n IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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" + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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, **kwargs" + } }, "set_storage_account" : { "sync": { - "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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\"\"\"" + "signature": "def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountCreateParameters\",\n **kwargs: Any\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 parameters: The parameters to create a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters\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, parameters" + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to create a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "update_storage_account" : { "sync": { - "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n parameters, # type: \"_models.StorageAccountUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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\"\"\"" + "signature": "def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters to update a storage account.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters\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, parameters" + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to update a storage account. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 parameters, # type: \"_models.StorageAccountRegenerteKeyParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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\"\"\"" + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: \"_models.StorageAccountRegenerteKeyParameters\",\n **kwargs: Any\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 parameters: The parameters to regenerate storage account key.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters\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, parameters" + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param parameters: The parameters to regenerate storage account key. Is either a model type or\n a IO type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 SasDefinitionItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "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: Any\n) -\u003e Iterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~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" + "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: Any\n) -\u003e AsyncIterable[\"_models.DeletedSasDefinitionItem\"]:\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\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. Default value is None.\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 DeletedSasDefinitionItem or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, storage_account_name, maxresults, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def recover_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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 # type: (...) -\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\"\"\"" + "signature": "def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" }, "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: Any\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" + "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: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\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, **kwargs" + } }, "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: \"_models.SasDefinitionCreateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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\"\"\"" + "signature": "def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionCreateParameters\",\n **kwargs: Any\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: The parameters to create a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters\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, parameters" + "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: Union[_models.SasDefinitionCreateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to create a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } }, "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, # type: \"_models.SasDefinitionUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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\"\"\"" + "signature": "def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" }, "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: \"_models.SasDefinitionUpdateParameters\",\n **kwargs: Any\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: The parameters to update a SAS definition.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters\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, parameters" + "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: Union[_models.SasDefinitionUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account. Required.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition. Required.\n:type sas_definition_name: str\n:param parameters: The parameters to update a SAS definition. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_vendor.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_configuration.py index f6e89c64060a..70a7128f9849 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", "7.0") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_key_vault_client.py index 6ea7e93e1c23..30630cac0343 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_key_vault_client_operations.py index d289d2e35470..89d3a02a3479 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_key_vault_client_operations.py @@ -6,104 +6,274 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_certificate_request, build_backup_key_request, build_backup_secret_request, build_backup_storage_account_request, build_create_certificate_request, build_create_key_request, build_decrypt_request, build_delete_certificate_contacts_request, build_delete_certificate_issuer_request, build_delete_certificate_operation_request, build_delete_certificate_request, build_delete_key_request, build_delete_sas_definition_request, build_delete_secret_request, build_delete_storage_account_request, build_encrypt_request, build_get_certificate_contacts_request, build_get_certificate_issuer_request, build_get_certificate_issuers_request, build_get_certificate_operation_request, build_get_certificate_policy_request, build_get_certificate_request, build_get_certificate_versions_request, build_get_certificates_request, build_get_deleted_certificate_request, build_get_deleted_certificates_request, build_get_deleted_key_request, build_get_deleted_keys_request, build_get_deleted_sas_definition_request, build_get_deleted_sas_definitions_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_deleted_storage_account_request, build_get_deleted_storage_accounts_request, build_get_key_request, build_get_key_versions_request, build_get_keys_request, build_get_sas_definition_request, build_get_sas_definitions_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_get_storage_account_request, build_get_storage_accounts_request, build_import_certificate_request, build_import_key_request, build_merge_certificate_request, build_purge_deleted_certificate_request, build_purge_deleted_key_request, build_purge_deleted_secret_request, build_purge_deleted_storage_account_request, build_recover_deleted_certificate_request, build_recover_deleted_key_request, build_recover_deleted_sas_definition_request, build_recover_deleted_secret_request, build_recover_deleted_storage_account_request, build_regenerate_storage_account_key_request, build_restore_certificate_request, build_restore_key_request, build_restore_secret_request, build_restore_storage_account_request, build_set_certificate_contacts_request, build_set_certificate_issuer_request, build_set_sas_definition_request, build_set_secret_request, build_set_storage_account_request, build_sign_request, build_unwrap_key_request, build_update_certificate_issuer_request, build_update_certificate_operation_request, build_update_certificate_policy_request, build_update_certificate_request, build_update_key_request, build_update_sas_definition_request, build_update_secret_request, build_update_storage_account_request, build_verify_request, build_wrap_key_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_certificate_request, + build_backup_key_request, + build_backup_secret_request, + build_backup_storage_account_request, + build_create_certificate_request, + build_create_key_request, + build_decrypt_request, + build_delete_certificate_contacts_request, + build_delete_certificate_issuer_request, + build_delete_certificate_operation_request, + build_delete_certificate_request, + build_delete_key_request, + build_delete_sas_definition_request, + build_delete_secret_request, + build_delete_storage_account_request, + build_encrypt_request, + build_get_certificate_contacts_request, + build_get_certificate_issuer_request, + build_get_certificate_issuers_request, + build_get_certificate_operation_request, + build_get_certificate_policy_request, + build_get_certificate_request, + build_get_certificate_versions_request, + build_get_certificates_request, + build_get_deleted_certificate_request, + build_get_deleted_certificates_request, + build_get_deleted_key_request, + build_get_deleted_keys_request, + build_get_deleted_sas_definition_request, + build_get_deleted_sas_definitions_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_deleted_storage_account_request, + build_get_deleted_storage_accounts_request, + build_get_key_request, + build_get_key_versions_request, + build_get_keys_request, + build_get_sas_definition_request, + build_get_sas_definitions_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_get_storage_account_request, + build_get_storage_accounts_request, + build_import_certificate_request, + build_import_key_request, + build_merge_certificate_request, + build_purge_deleted_certificate_request, + build_purge_deleted_key_request, + build_purge_deleted_secret_request, + build_purge_deleted_storage_account_request, + build_recover_deleted_certificate_request, + build_recover_deleted_key_request, + build_recover_deleted_sas_definition_request, + build_recover_deleted_secret_request, + build_recover_deleted_storage_account_request, + build_regenerate_storage_account_key_request, + build_restore_certificate_request, + build_restore_key_request, + build_restore_secret_request, + build_restore_storage_account_request, + build_set_certificate_contacts_request, + build_set_certificate_issuer_request, + build_set_sas_definition_request, + build_set_secret_request, + build_set_storage_account_request, + build_sign_request, + build_unwrap_key_request, + build_update_certificate_issuer_request, + build_update_certificate_operation_request, + build_update_certificate_policy_request, + build_update_certificate_request, + build_update_key_request, + build_update_sas_definition_request, + build_update_secret_request, + build_update_storage_account_request, + build_verify_request, + build_wrap_key_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: # pylint: disable=too-many-public-methods - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload async def create_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace_async + @overload async def import_key( self, vault_base_url: str, key_name: str, - parameters: "_models.KeyImportParameters", + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -111,70 +281,140 @@ async def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace_async - async def delete_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -182,56 +422,131 @@ async def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_key( @@ -239,9 +554,9 @@ async def update_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyUpdateParameters", + parameters: Union[_models.KeyUpdateParameters, IO], **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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. @@ -249,29 +564,45 @@ async def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -279,168 +610,168 @@ async def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace_async - async def get_key( - self, - vault_base_url: str, - key_name: str, - key_version: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url: str, - key_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -454,33 +785,26 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -488,53 +812,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -548,33 +876,24 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace_async - async def backup_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.BackupKeyResult": + async def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -589,64 +908,71 @@ async def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace_async + @overload async def restore_key( self, vault_base_url: str, - parameters: "_models.KeyRestoreParameters", + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyBundle": + ) -> _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, @@ -660,69 +986,148 @@ async def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") request = build_restore_key_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_key.metadata['url'], + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore - + restore_key.metadata = {"url": "/keys/restore"} # type: ignore - @distributed_trace_async + @overload async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -734,107 +1139,290 @@ async def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. + :param parameters: The parameters for the encryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyOperationsParameters') - - request = build_encrypt_request( - key_name=key_name, - key_version=key_version, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.encrypt.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('KeyOperationResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore - - @distributed_trace_async - async def decrypt( + @overload + async def encrypt( self, vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.KeyOperationResult": - """Decrypts a single block of encrypted data. + ) -> _models.KeyOperationResult: + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. - 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 + 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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") + + request = build_encrypt_request( + key_name=key_name, + key_version=key_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KeyOperationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. + :param parameters: The parameters for the decryption operation. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -842,35 +1430,104 @@ async def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def sign( @@ -878,38 +1535,54 @@ async def sign( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeySignParameters", + parameters: Union[_models.KeySignParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeySignParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -917,35 +1590,108 @@ async def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def verify( @@ -953,9 +1699,9 @@ async def verify( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyVerifyParameters", + parameters: Union[_models.KeyVerifyParameters, IO], **kwargs: Any - ) -> "_models.KeyVerifyResult": + ) -> _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 @@ -964,29 +1710,45 @@ async def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -994,35 +1756,110 @@ async def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def wrap_key( @@ -1030,9 +1867,9 @@ async def wrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1042,29 +1879,45 @@ async def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -1072,35 +1925,106 @@ async def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace_async async def unwrap_key( @@ -1108,9 +2032,9 @@ async def unwrap_key( vault_base_url: str, key_name: str, key_version: str, - parameters: "_models.KeyOperationsParameters", + parameters: Union[_models.KeyOperationsParameters, IO], **kwargs: Any - ) -> "_models.KeyOperationResult": + ) -> _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 @@ -1118,29 +2042,45 @@ async def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -1148,43 +2088,41 @@ async def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedKeyListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedKeyItem"]: """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 @@ -1193,55 +2131,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1255,96 +2195,89 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace_async - async def get_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.DeletedKeyBundle": + async def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async async def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - key_name: str, - **kwargs: Any + self, vault_base_url: str, key_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified key. @@ -1352,60 +2285,60 @@ async def purge_deleted_key( # pylint: disable=inconsistent-return-statements 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace_async - async def recover_deleted_key( - self, - vault_base_url: str, - key_name: str, - **kwargs: Any - ) -> "_models.KeyBundle": + async def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -1413,190 +2346,338 @@ async def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_secret( - self, - vault_base_url: str, - secret_name: str, - parameters: "_models.SecretSetParameters", - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. - :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_secret( @@ -1604,38 +2685,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -1643,164 +2740,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1814,90 +2914,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -1911,87 +3006,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2005,95 +3095,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -2101,244 +3186,314 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace def get_certificates( @@ -2347,13 +3502,13 @@ def get_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -2362,51 +3517,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2420,336 +3576,395 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace_async async def delete_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def set_certificate_contacts( - self, - vault_base_url: str, - contacts: "_models.Contacts", - **kwargs: Any - ) -> "_models.Contacts": + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def get_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace_async - async def delete_certificate_contacts( - self, - vault_base_url: str, - **kwargs: Any - ) -> "_models.Contacts": + async def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateIssuerListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -2763,371 +3978,666 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace_async + @overload async def set_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerSetParameters", + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_issuer( self, vault_base_url: str, issuer_name: str, - parameter: "_models.CertificateIssuerUpdateParameters", + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], **kwargs: Any - ) -> "_models.IssuerBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def get_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace_async async def delete_certificate_issuer( - self, - vault_base_url: str, - issuer_name: str, - **kwargs: Any - ) -> "_models.IssuerBundle": + self, vault_base_url: str, issuer_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateCreateParameters", + parameters: Union[_models.CertificateCreateParameters, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def import_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateImportParameters", + parameters: Union[_models.CertificateImportParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -3135,129 +4645,143 @@ async def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace def get_certificate_versions( - self, - vault_base_url: str, - certificate_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateListResult"]: + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3271,158 +4795,301 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace_async async def get_certificate_policy( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificatePolicy": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_policy( self, vault_base_url: str, certificate_name: str, - certificate_policy: "_models.CertificatePolicy", + certificate_policy: Union[_models.CertificatePolicy, IO], **kwargs: Any - ) -> "_models.CertificatePolicy": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate( @@ -3430,38 +5097,54 @@ async def update_certificate( vault_base_url: str, certificate_name: str, certificate_version: str, - parameters: "_models.CertificateUpdateParameters", + parameters: Union[_models.CertificateUpdateParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -3469,501 +5152,729 @@ async def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace_async async def get_certificate( - self, - vault_base_url: str, - certificate_name: str, - certificate_version: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_certificate_operation( self, vault_base_url: str, certificate_name: str, - certificate_operation: "_models.CertificateOperationUpdateParameter", + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], **kwargs: Any - ) -> "_models.CertificateOperation": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def get_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace_async async def delete_certificate_operation( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateOperation": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def merge_certificate( self, vault_base_url: str, certificate_name: str, - parameters: "_models.CertificateMergeParameters", + parameters: Union[_models.CertificateMergeParameters, IO], **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace_async async def backup_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.BackupCertificateResult": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_certificate( self, vault_base_url: str, - parameters: "_models.CertificateRestoreParameters", + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CertificateBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace def get_deleted_certificates( @@ -3972,7 +5883,7 @@ def get_deleted_certificates( maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeletedCertificateListResult"]: + ) -> AsyncIterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -3980,7 +5891,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -3989,51 +5900,54 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4047,96 +5961,91 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace_async async def get_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.DeletedCertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any + self, vault_base_url: str, certificate_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified deleted certificate. @@ -4144,60 +6053,62 @@ async def purge_deleted_certificate( # pylint: disable=inconsistent-return-stat 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace_async async def recover_deleted_certificate( - self, - vault_base_url: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateBundle": + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -4205,114 +6116,120 @@ async def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.StorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4326,87 +6243,84 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedStorageListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4420,95 +6334,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace_async async def get_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any + self, vault_base_url: str, storage_account_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified storage account. @@ -4516,634 +6425,924 @@ async def purge_deleted_storage_account( # pylint: disable=inconsistent-return- 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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace_async async def recover_deleted_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace_async async def backup_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.BackupStorageResult": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore + + @overload + async def restore_storage_account( + self, + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + @overload + async def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def restore_storage_account( - self, - vault_base_url: str, - parameters: "_models.StorageRestoreParameters", - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace_async async def delete_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.DeletedStorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace_async async def get_storage_account( - self, - vault_base_url: str, - storage_account_name: str, - **kwargs: Any - ) -> "_models.StorageBundle": + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountCreateParameters", + parameters: Union[_models.StorageAccountCreateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_storage_account( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountUpdateParameters", + parameters: Union[_models.StorageAccountUpdateParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def regenerate_storage_account_key( self, vault_base_url: str, storage_account_name: str, - parameters: "_models.StorageAccountRegenerteKeyParameters", + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], **kwargs: Any - ) -> "_models.StorageBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5157,92 +7356,87 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url: str, - storage_account_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSasDefinitionListResult"]: + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5256,290 +7450,352 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace_async async def get_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def recover_deleted_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace_async async def delete_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.DeletedSasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace_async async def get_sas_definition( - self, - vault_base_url: str, - storage_account_name: str, - sas_definition_name: str, - **kwargs: Any - ) -> "_models.SasDefinitionBundle": + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def set_sas_definition( @@ -5547,35 +7803,51 @@ async def set_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionCreateParameters", + parameters: Union[_models.SasDefinitionCreateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -5583,35 +7855,98 @@ async def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace_async async def update_sas_definition( @@ -5619,35 +7954,51 @@ async def update_sas_definition( vault_base_url: str, storage_account_name: str, sas_definition_name: str, - parameters: "_models.SasDefinitionUpdateParameters", + parameters: Union[_models.SasDefinitionUpdateParameters, IO], **kwargs: Any - ) -> "_models.SasDefinitionBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -5655,32 +8006,33 @@ async def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/__init__.py index 433900a34cfd..6726525a0e5d 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/__init__.py @@ -6,296 +6,208 @@ # 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 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 - 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 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 - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult - 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 # 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 ._models_py3 import Action +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 +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 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 +from ._models_py3 import KeyVerifyParameters +from ._models_py3 import KeyVerifyResult +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 -from ._key_vault_client_enums import ( - ActionType, - DeletionRecoveryLevel, - JsonWebKeyCurveName, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeyOperation, - JsonWebKeySignatureAlgorithm, - JsonWebKeyType, - KeyUsageType, - SasTokenType, -) +from ._key_vault_client_enums import ActionType +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._key_vault_client_enums import JsonWebKeyCurveName +from ._key_vault_client_enums import JsonWebKeyEncryptionAlgorithm +from ._key_vault_client_enums import JsonWebKeyOperation +from ._key_vault_client_enums import JsonWebKeySignatureAlgorithm +from ._key_vault_client_enums import JsonWebKeyType +from ._key_vault_client_enums import KeyUsageType +from ._key_vault_client_enums import SasTokenType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Action', - 'AdministratorDetails', - 'Attributes', - 'BackupCertificateResult', - 'BackupKeyResult', - 'BackupSecretResult', - 'BackupStorageResult', - 'CertificateAttributes', - 'CertificateBundle', - 'CertificateCreateParameters', - 'CertificateImportParameters', - 'CertificateIssuerItem', - 'CertificateIssuerListResult', - 'CertificateIssuerSetParameters', - 'CertificateIssuerUpdateParameters', - 'CertificateItem', - 'CertificateListResult', - 'CertificateMergeParameters', - 'CertificateOperation', - 'CertificateOperationUpdateParameter', - 'CertificatePolicy', - 'CertificateRestoreParameters', - 'CertificateUpdateParameters', - 'Contact', - 'Contacts', - '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', - 'KeyVerifyParameters', - 'KeyVerifyResult', - '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', - 'JsonWebKeyCurveName', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeyOperation', - 'JsonWebKeySignatureAlgorithm', - 'JsonWebKeyType', - 'KeyUsageType', - 'SasTokenType', + "Action", + "AdministratorDetails", + "Attributes", + "BackupCertificateResult", + "BackupKeyResult", + "BackupSecretResult", + "BackupStorageResult", + "CertificateAttributes", + "CertificateBundle", + "CertificateCreateParameters", + "CertificateImportParameters", + "CertificateIssuerItem", + "CertificateIssuerListResult", + "CertificateIssuerSetParameters", + "CertificateIssuerUpdateParameters", + "CertificateItem", + "CertificateListResult", + "CertificateMergeParameters", + "CertificateOperation", + "CertificateOperationUpdateParameter", + "CertificatePolicy", + "CertificateRestoreParameters", + "CertificateUpdateParameters", + "Contact", + "Contacts", + "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", + "KeyVerifyParameters", + "KeyVerifyResult", + "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", + "JsonWebKeyCurveName", + "JsonWebKeyEncryptionAlgorithm", + "JsonWebKeyOperation", + "JsonWebKeySignatureAlgorithm", + "JsonWebKeyType", + "KeyUsageType", + "SasTokenType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_key_vault_client_enums.py index fc28dcf37707..4904e43a94fb 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_key_vault_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action.""" EMAIL_CONTACTS = "EmailContacts" AUTO_RENEW = "AutoRenew" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -27,22 +26,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees @@ -61,9 +60,9 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: that the subscription itself cannot be cancelled. CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Elliptic curve name. For valid values, see JsonWebKeyCurveName. - """ + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName.""" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 = "P-256" @@ -74,17 +73,17 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The SECG SECP256K1 elliptic curve. P256_K = "P-256K" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """algorithm identifier - """ + +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """algorithm identifier.""" RSA_OAEP = "RSA-OAEP" RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """JSON web key operations. For more information, see JsonWebKeyOperation. - """ + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JSON web key operations. For more information, see JsonWebKeyOperation.""" ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -93,38 +92,40 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WRAP_KEY = "wrapKey" UNWRAP_KEY = "unwrapKey" -class JsonWebKeySignatureAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeySignatureAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. """ #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS256 = "PS256" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS384 = "PS384" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in - #: https://tools.ietf.org/html/rfc7518. + #: https://tools.ietf.org/html/rfc7518 PS512 = "PS512" - #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 = "RS256" - #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 = "RS384" - #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 = "RS512" - #: Reserved. + #: Reserved RSNULL = "RSNULL" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 = "ES256" - #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 = "ES384" - #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 = "ES512" - #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 ES256_K = "ES256K" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. """ @@ -133,14 +134,16 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EC = "EC" #: Elliptic Curve with a private key which is not exportable from the HSM. EC_HSM = "EC-HSM" - #: RSA (https://tools.ietf.org/html/rfc3447). + #: RSA (https://tools.ietf.org/html/rfc3447) RSA = "RSA" #: RSA with a private key which is not exportable from the HSM. RSA_HSM = "RSA-HSM" - #: Not supported in this version. Octet sequence (used to represent symmetric keys). + #: Not supported in this version. Octet sequence (used to represent symmetric keys) OCT = "oct" -class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyUsageType.""" DIGITAL_SIGNATURE = "digitalSignature" NON_REPUDIATION = "nonRepudiation" @@ -152,9 +155,9 @@ class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCIPHER_ONLY = "encipherOnly" DECIPHER_ONLY = "decipherOnly" -class SasTokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of SAS token the SAS definition will create. - """ + +class SasTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of SAS token the SAS definition will create.""" ACCOUNT = "account" SERVICE = "service" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models.py deleted file mode 100644 index a8b606c71a97..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models.py +++ /dev/null @@ -1,3975 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """The action that will be executed. - - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - - _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". - :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType - """ - 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. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar email_address: Email address. - :vartype email_address: str - :ivar phone: Phone number. - :vartype 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 - ): - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword email_address: Email address. - :paramtype email_address: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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(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. - - :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(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. - - :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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(CertificateAttributes, self).__init__(**kwargs) - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. - :vartype base64_encoded_certificate: str - :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used - for encryption. - :vartype password: str - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. - :paramtype base64_encoded_certificate: str - :keyword password: If the private key in base64EncodedCertificate is encrypted, the password - used for encryption. - :paramtype password: str - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar id: Certificate Identifier. - :vartype id: str - :ivar provider: The issuer provider. - :vartype provider: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Certificate Identifier. - :paramtype id: str - :keyword provider: The issuer provider. - :paramtype provider: str - """ - 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_0.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. - - :ivar provider: Required. The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: Required. The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - """ - 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_0.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. - - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :vartype csr: bytearray - :ivar cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :vartype cancellation_requested: bool - :ivar status: Status of the certificate operation. - :vartype status: str - :ivar status_details: The status details of the certificate operation. - :vartype status_details: str - :ivar error: Error encountered, if any, during the certificate operation. - :vartype error: ~azure.keyvault.v7_0.models.Error - :ivar target: Location which contains the result of the certificate operation. - :vartype target: str - :ivar request_id: Identifier for the certificate operation. - :vartype 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 - ): - """ - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword csr: The certificate signing request (CSR) that is being used in the certificate - operation. - :paramtype csr: bytearray - :keyword cancellation_requested: Indicates if cancellation was requested on the certificate - operation. - :paramtype cancellation_requested: bool - :keyword status: Status of the certificate operation. - :paramtype status: str - :keyword status_details: The status details of the certificate operation. - :paramtype status_details: str - :keyword error: Error encountered, if any, during the certificate operation. - :paramtype error: ~azure.keyvault.v7_0.models.Error - :keyword target: Location which contains the result of the certificate operation. - :paramtype target: str - :keyword request_id: Identifier for the certificate operation. - :paramtype request_id: str - """ - 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. - - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :vartype cancellation_requested: bool - """ - - _validation = { - 'cancellation_requested': {'required': True}, - } - - _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. - :paramtype cancellation_requested: bool - """ - 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 - :ivar key_properties: Properties of the key backing a certificate. - :vartype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :ivar secret_properties: Properties of the secret backing a certificate. - :vartype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :ivar x509_certificate_properties: Properties of the X509 component of a certificate. - :vartype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :ivar lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :vartype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :ivar issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword key_properties: Properties of the key backing a certificate. - :paramtype key_properties: ~azure.keyvault.v7_0.models.KeyProperties - :keyword secret_properties: Properties of the secret backing a certificate. - :paramtype secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :keyword x509_certificate_properties: Properties of the X509 component of a certificate. - :paramtype x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties - :keyword lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a - certificate. - :paramtype lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :keyword issuer_parameters: Parameters for the issuer of the X509 component of a certificate. - :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - """ - 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. - - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :vartype certificate_bundle_backup: bytes - """ - - _validation = { - 'certificate_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. - :paramtype certificate_bundle_backup: bytes - """ - super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] - - -class CertificateUpdateParameters(msrest.serialization.Model): - """The certificate update parameters. - - :ivar certificate_policy: The management policy for the certificate. - :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :ivar certificate_attributes: The attributes of the certificate (optional). - :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword certificate_policy: The management policy for the certificate. - :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :keyword certificate_attributes: The attributes of the certificate (optional). - :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar email_address: Email address. - :vartype email_address: str - :ivar name: Name. - :vartype name: str - :ivar phone: Phone number. - :vartype phone: str - """ - - _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword email_address: Email address. - :paramtype email_address: str - :keyword name: Name. - :paramtype name: str - :keyword phone: Phone number. - :paramtype phone: str - """ - 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 - :ivar contact_list: The contact list for the vault certificates. - :vartype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword contact_list: The contact list for the vault certificates. - :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] - """ - 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_0.models.CertificatePolicy - :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The certificate attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The certificate attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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. - - :ivar id: Certificate identifier. - :vartype id: str - :ivar attributes: The certificate management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar x509_thumbprint: Thumbprint of the certificate. - :vartype x509_thumbprint: bytes - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :vartype 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 - ): - """ - :keyword id: Certificate identifier. - :paramtype id: str - :keyword attributes: The certificate management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword x509_thumbprint: Thumbprint of the certificate. - :paramtype x509_thumbprint: bytes - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - certificate. - :paramtype recovery_id: str - """ - 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_0.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 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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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 - - -class DeletedKeyBundle(KeyBundle): - """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. - - :ivar key: The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', 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. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar attributes: The key management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :vartype recovery_id: str - :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 = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword attributes: The key management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - key. - :paramtype recovery_id: str - """ - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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. - - :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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _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}'}, - } - - 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 - - -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. - - 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_0.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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _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}, - } - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None - - -class DeletedSasDefinitionItem(SasDefinitionItem): - """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. - - :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_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS - definition. - :vartype 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.datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC. - :vartype deleted_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'secret_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'}, - '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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - SAS definition. - :paramtype recovery_id: str - """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_0.models.StorageAccountAttributes - :ivar tags: A set of 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_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :vartype 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.datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC. - :vartype deleted_date: ~datetime.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 - ): - """ - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - storage account. - :paramtype recovery_id: str - """ - super(DeletedStorageBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 - """ - - _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(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_0.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. - - :ivar enabled: Determines whether the issuer is enabled. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the issuer is enabled. - :paramtype enabled: bool - """ - 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 - :ivar provider: The issuer provider. - :vartype provider: str - :ivar credentials: The credentials to be used for the issuer. - :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :ivar organization_details: Details of the organization as provided to the issuer. - :vartype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :ivar attributes: Attributes of the issuer object. - :vartype attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword provider: The issuer provider. - :paramtype provider: str - :keyword credentials: The credentials to be used for the issuer. - :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :keyword organization_details: Details of the organization as provided to the issuer. - :paramtype organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails - :keyword attributes: Attributes of the issuer object. - :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - """ - 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. - - :ivar account_id: The user name/account name/account id. - :vartype account_id: str - :ivar password: The password/secret/account key. - :vartype password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword account_id: The user name/account name/account id. - :paramtype account_id: str - :keyword password: The password/secret/account key. - :paramtype password: str - """ - 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. - - :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :vartype name: str - :ivar certificate_type: Certificate type as supported by the provider (optional); for example - 'OV-SSL', 'EV-SSL'. - :vartype certificate_type: str - :ivar certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :vartype 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 - ): - """ - :keyword name: Name of the referenced issuer object or reserved names; for example, 'Self' or - 'Unknown'. - :paramtype name: str - :keyword certificate_type: Certificate type as supported by the provider (optional); for - example 'OV-SSL', 'EV-SSL'. - :paramtype certificate_type: str - :keyword certificate_transparency: Indicates if the certificates generated under this policy - should be published to certificate transparency logs. - :paramtype certificate_transparency: bool - """ - 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(msrest.serialization.Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :ivar kid: Key identifier. - :vartype kid: str - :ivar 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". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str] - :ivar n: RSA modulus. - :vartype n: bytes - :ivar e: RSA public exponent. - :vartype e: bytes - :ivar d: RSA private exponent, or the D component of an EC private key. - :vartype d: bytes - :ivar dp: RSA private key parameter. - :vartype dp: bytes - :ivar dq: RSA private key parameter. - :vartype dq: bytes - :ivar qi: RSA private key parameter. - :vartype qi: bytes - :ivar p: RSA secret prime. - :vartype p: bytes - :ivar q: RSA secret prime, with p < q. - :vartype q: bytes - :ivar k: Symmetric key. - :vartype k: bytes - :ivar t: HSM Token, used with 'Bring Your Own Key'. - :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :ivar x: X component of an EC public key. - :vartype x: bytes - :ivar y: Y component of an EC public key. - :vartype 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 - ): - """ - :keyword kid: Key identifier. - :paramtype kid: str - :keyword 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". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str] - :keyword n: RSA modulus. - :paramtype n: bytes - :keyword e: RSA public exponent. - :paramtype e: bytes - :keyword d: RSA private exponent, or the D component of an EC private key. - :paramtype d: bytes - :keyword dp: RSA private key parameter. - :paramtype dp: bytes - :keyword dq: RSA private key parameter. - :paramtype dq: bytes - :keyword qi: RSA private key parameter. - :paramtype qi: bytes - :keyword p: RSA secret prime. - :paramtype p: bytes - :keyword q: RSA secret prime, with p < q. - :paramtype q: bytes - :keyword k: Symmetric key. - :paramtype k: bytes - :keyword t: HSM Token, used with 'Bring Your Own Key'. - :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :keyword x: X component of an EC public key. - :paramtype x: bytes - :keyword y: Y component of an EC public key. - :paramtype y: bytes - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(KeyAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar key_ops: - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True}, - } - - _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 - ): - """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - super(KeyCreateParameters, self).__init__(**kwargs) - 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) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(msrest.serialization.Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar hsm: Whether to import as a hardware key (HSM) or software key. - :vartype hsm: bool - :ivar key: Required. The Json web key. - :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey - :ivar key_attributes: The key management attributes. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword hsm: Whether to import as a hardware key (HSM) or software key. - :paramtype hsm: bool - :keyword key: Required. The Json web key. - :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey - :keyword key_attributes: The key management attributes. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs['key'] - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(msrest.serialization.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_0.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(msrest.serialization.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(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyProperties(msrest.serialization.Model): - """Properties of the key pair backing a certificate. - - :ivar exportable: Indicates if the private key can be exported. - :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :vartype key_size: int - :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. - :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :vartype curve: str or ~azure.keyvault.v7_0.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 - ): - """ - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". - :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :paramtype key_size: int - :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. - :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". - :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - """ - 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(msrest.serialization.Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. - :vartype key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. - :paramtype key_bundle_backup: bytes - """ - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs['key_bundle_backup'] - - -class KeySignParameters(msrest.serialization.Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar value: Required. - :vartype value: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword value: Required. - :paramtype value: bytes - """ - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.value = kwargs['value'] - - -class KeyUpdateParameters(msrest.serialization.Model): - """The key update parameters. - - :ivar key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :ivar key_attributes: The attributes of a key managed by the key vault service. - :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword key_ops: Json web key operations. For more information on possible key operations, see - JsonWebKeyOperation. - :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :keyword key_attributes: The attributes of a key managed by the key vault service. - :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(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_0.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 KeyVerifyParameters(msrest.serialization.Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. - :vartype digest: bytes - :ivar signature: Required. The signature to be verified. - :vartype signature: bytes - """ - - _validation = { - 'algorithm': {'required': True}, - '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 - ): - """ - :keyword 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". - :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. - :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. - :paramtype signature: bytes - """ - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs['algorithm'] - self.digest = kwargs['digest'] - self.signature = kwargs['signature'] - - -class KeyVerifyResult(msrest.serialization.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(msrest.serialization.Model): - """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - - :ivar trigger: The condition that will execute the action. - :vartype trigger: ~azure.keyvault.v7_0.models.Trigger - :ivar action: The action that will be executed. - :vartype action: ~azure.keyvault.v7_0.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword trigger: The condition that will execute the action. - :paramtype trigger: ~azure.keyvault.v7_0.models.Trigger - :keyword action: The action that will be executed. - :paramtype action: ~azure.keyvault.v7_0.models.Action - """ - 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. - - :ivar id: Id of the organization. - :vartype id: str - :ivar admin_details: Details of the organization administrator. - :vartype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Id of the organization. - :paramtype id: str - :keyword admin_details: Details of the organization administrator. - :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] - """ - 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 SasDefinitionAttributes(msrest.serialization.Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class SasDefinitionCreateParameters(msrest.serialization.Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar 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. - :vartype template_uri: str - :ivar sas_type: Required. 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: Required. The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - 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(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. - - :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 - """ - - _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(msrest.serialization.Model): - """The SAS definition update parameters. - - :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_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according to the SAS - definition. - :vartype validity_period: str - :ivar sas_definition_attributes: The attributes of the SAS definition. - :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword 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. - :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". - :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: The validity period of SAS tokens created according to the SAS - definition. - :paramtype validity_period: str - :keyword sas_definition_attributes: The attributes of the SAS definition. - :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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_0.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: the enabled state of the object. - :vartype enabled: bool - :ivar created: Creation time in UTC. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in UTC. - :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", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", - "CustomizedRecoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword enabled: the enabled state of the object. - :paramtype enabled: bool - """ - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Storage account resource id. - :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: Required. 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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword resource_id: Required. Storage account resource id. - :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. The storage account key name. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. The storage account key name. - :paramtype key_name: str - """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The storage account update parameters. - - :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 storage_account_attributes: The attributes of the storage account. - :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword active_key_name: The current active storage account key name. - :paramtype active_key_name: str - :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. - :paramtype auto_regenerate_key: bool - :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. - :paramtype regeneration_period: str - :keyword storage_account_attributes: The attributes of the storage account. - :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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(msrest.serialization.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_0.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(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. - :vartype storage_bundle_backup: bytes - """ - - _validation = { - 'storage_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. - :paramtype storage_bundle_backup: bytes - """ - super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = kwargs['storage_bundle_backup'] - - -class SubjectAlternativeNames(msrest.serialization.Model): - """The subject alternate names of a X509 object. - - :ivar emails: Email addresses. - :vartype emails: list[str] - :ivar dns_names: Domain names. - :vartype dns_names: list[str] - :ivar upns: User principal names. - :vartype 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 - ): - """ - :keyword emails: Email addresses. - :paramtype emails: list[str] - :keyword dns_names: Domain names. - :paramtype dns_names: list[str] - :keyword upns: User principal names. - :paramtype upns: list[str] - """ - 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. - - :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between - 1 and 99. - :vartype lifetime_percentage: int - :ivar 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). - :vartype 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 - ): - """ - :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be - between 1 and 99. - :paramtype lifetime_percentage: int - :keyword 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). - :paramtype days_before_expiry: int - """ - 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. - - :ivar subject: The subject name. Should be a valid X509 distinguished Name. - :vartype subject: str - :ivar ekus: The enhanced key usage. - :vartype ekus: list[str] - :ivar subject_alternative_names: The subject alternative names. - :vartype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :ivar key_usage: List of key usages. - :vartype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :ivar validity_in_months: The duration that the certificate is valid in months. - :vartype 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 - ): - """ - :keyword subject: The subject name. Should be a valid X509 distinguished Name. - :paramtype subject: str - :keyword ekus: The enhanced key usage. - :paramtype ekus: list[str] - :keyword subject_alternative_names: The subject alternative names. - :paramtype subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames - :keyword key_usage: List of key usages. - :paramtype key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :keyword validity_in_months: The duration that the certificate is valid in months. - :paramtype validity_in_months: int - """ - 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-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models_py3.py index ff95bb20a6a6..1d042e3ec757 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,37 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization -from ._key_vault_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Action(msrest.serialization.Model): +class Action(_serialization.Model): """The action that will be executed. - :ivar action_type: The type of the action. Possible values include: "EmailContacts", - "AutoRenew". + :ivar action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :vartype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'str'}, + "action_type": {"key": "action_type", "type": "str"}, } - def __init__( - self, - *, - action_type: Optional[Union[str, "ActionType"]] = None, - **kwargs - ): + def __init__(self, *, action_type: Optional[Union[str, "_models.ActionType"]] = None, **kwargs): """ - :keyword action_type: The type of the action. Possible values include: "EmailContacts", + :keyword action_type: The type of the action. Known values are: "EmailContacts" and "AutoRenew". :paramtype action_type: str or ~azure.keyvault.v7_0.models.ActionType """ - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(msrest.serialization.Model): +class AdministratorDetails(_serialization.Model): """Details of the organization administrator of the certificate issuer. :ivar first_name: First name. @@ -56,10 +52,10 @@ class AdministratorDetails(msrest.serialization.Model): """ _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'}, + "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__( @@ -81,14 +77,14 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(AdministratorDetails, self).__init__(**kwargs) + super().__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): +class Attributes(_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. @@ -106,16 +102,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -134,7 +130,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -142,7 +138,7 @@ def __init__( self.updated = None -class BackupCertificateResult(msrest.serialization.Model): +class BackupCertificateResult(_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. @@ -152,24 +148,20 @@ class BackupCertificateResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupCertificateResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupKeyResult(msrest.serialization.Model): +class BackupKeyResult(_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. @@ -179,24 +171,20 @@ class BackupKeyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupKeyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -206,24 +194,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class BackupStorageResult(msrest.serialization.Model): +class BackupStorageResult(_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. @@ -233,20 +217,16 @@ class BackupStorageResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupStorageResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None @@ -268,25 +248,25 @@ class CertificateAttributes(Attributes): :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". + retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -305,11 +285,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(msrest.serialization.Model): +class CertificateBundle(_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. @@ -325,55 +305,55 @@ class CertificateBundle(msrest.serialization.Model): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'kid': {'readonly': True}, - 'sid': {'readonly': True}, - 'x509_thumbprint': {'readonly': True}, - 'policy': {'readonly': True}, + "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}'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.kid = None self.sid = None @@ -385,28 +365,28 @@ def __init__( self.tags = tags -class CertificateCreateParameters(msrest.serialization.Model): +class CertificateCreateParameters(_serialization.Model): """The certificate create parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -415,22 +395,22 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(msrest.serialization.Model): +class CertificateImportParameters(_serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :ivar base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM files - need to contain the private key. + :ivar base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need to + contain the private key. Required. :vartype base64_encoded_certificate: str :ivar password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -439,20 +419,20 @@ class CertificateImportParameters(msrest.serialization.Model): :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'base64_encoded_certificate': {'required': True}, + "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}'}, + "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__( @@ -460,14 +440,14 @@ def __init__( *, base64_encoded_certificate: str, password: Optional[str] = None, - certificate_policy: Optional["CertificatePolicy"] = None, - certificate_attributes: Optional["CertificateAttributes"] = None, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword base64_encoded_certificate: Required. A PEM file or a base64-encoded PFX file. PEM - files need to contain the private key. + :keyword base64_encoded_certificate: A PEM file or a base64-encoded PFX file. PEM files need + to contain the private key. Required. :paramtype base64_encoded_certificate: str :keyword password: If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @@ -476,10 +456,10 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password self.certificate_policy = certificate_policy @@ -487,7 +467,7 @@ def __init__( self.tags = tags -class CertificateIssuerItem(msrest.serialization.Model): +class CertificateIssuerItem(_serialization.Model): """The certificate issuer item containing certificate issuer metadata. :ivar id: Certificate Identifier. @@ -497,16 +477,12 @@ class CertificateIssuerItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, } def __init__( - self, - *, - id: Optional[str] = None, - provider: Optional[str] = None, - **kwargs + self, *, id: Optional[str] = None, provider: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin ): """ :keyword id: Certificate Identifier. @@ -514,12 +490,12 @@ def __init__( :keyword provider: The issuer provider. :paramtype provider: str """ - super(CertificateIssuerItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(msrest.serialization.Model): +class CertificateIssuerListResult(_serialization.Model): """The certificate issuer list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -532,32 +508,28 @@ class CertificateIssuerListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateIssuerItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateIssuerListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(msrest.serialization.Model): +class CertificateIssuerSetParameters(_serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. - :ivar provider: Required. The issuer provider. + :ivar provider: The issuer provider. Required. :vartype provider: str :ivar credentials: The credentials to be used for the issuer. :vartype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -568,27 +540,27 @@ class CertificateIssuerSetParameters(msrest.serialization.Model): """ _validation = { - 'provider': {'required': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ - :keyword provider: Required. The issuer provider. + :keyword provider: The issuer provider. Required. :paramtype provider: str :keyword credentials: The credentials to be used for the issuer. :paramtype credentials: ~azure.keyvault.v7_0.models.IssuerCredentials @@ -597,14 +569,14 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateIssuerUpdateParameters(msrest.serialization.Model): +class CertificateIssuerUpdateParameters(_serialization.Model): """The certificate issuer update parameters. :ivar provider: The issuer provider. @@ -618,19 +590,19 @@ class CertificateIssuerUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -643,38 +615,38 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.credentials = credentials self.organization_details = organization_details self.attributes = attributes -class CertificateItem(msrest.serialization.Model): +class CertificateItem(_serialization.Model): """The certificate item containing certificate metadata. :ivar id: Certificate identifier. :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype 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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, **kwargs @@ -684,19 +656,19 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes """ - super(CertificateItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags self.x509_thumbprint = x509_thumbprint -class CertificateListResult(msrest.serialization.Model): +class CertificateListResult(_serialization.Model): """The certificate list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -709,72 +681,68 @@ class CertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(msrest.serialization.Model): +class CertificateMergeParameters(_serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :ivar x509_certificates: Required. The certificate or the certificate chain to merge. - :vartype x509_certificates: list[bytearray] + :ivar x509_certificates: The certificate or the certificate chain to merge. Required. + :vartype x509_certificates: list[bytes] :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'x509_certificates': {'required': True}, + "x509_certificates": {"required": True}, } _attribute_map = { - 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + x509_certificates: List[bytes], + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword x509_certificates: Required. The certificate or the certificate chain to merge. - :paramtype x509_certificates: list[bytearray] + :keyword x509_certificates: The certificate or the certificate chain to merge. Required. + :paramtype x509_certificates: list[bytes] :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateMergeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(msrest.serialization.Model): +class CertificateOperation(_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. @@ -785,7 +753,7 @@ class CertificateOperation(msrest.serialization.Model): :vartype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :ivar csr: The certificate signing request (CSR) that is being used in the certificate operation. - :vartype csr: bytearray + :vartype csr: bytes :ivar cancellation_requested: Indicates if cancellation was requested on the certificate operation. :vartype cancellation_requested: bool @@ -802,30 +770,30 @@ class CertificateOperation(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + csr: Optional[bytes] = None, cancellation_requested: Optional[bool] = None, status: Optional[str] = None, status_details: Optional[str] = None, - error: Optional["Error"] = None, + error: Optional["_models.Error"] = None, target: Optional[str] = None, request_id: Optional[str] = None, **kwargs @@ -835,7 +803,7 @@ def __init__( :paramtype issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :keyword csr: The certificate signing request (CSR) that is being used in the certificate operation. - :paramtype csr: bytearray + :paramtype csr: bytes :keyword cancellation_requested: Indicates if cancellation was requested on the certificate operation. :paramtype cancellation_requested: bool @@ -850,7 +818,7 @@ def __init__( :keyword request_id: Identifier for the certificate operation. :paramtype request_id: str """ - super(CertificateOperation, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters self.csr = csr @@ -862,40 +830,35 @@ def __init__( self.request_id = request_id -class CertificateOperationUpdateParameter(msrest.serialization.Model): +class CertificateOperationUpdateParameter(_serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :ivar cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :ivar cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :vartype cancellation_requested: bool """ _validation = { - 'cancellation_requested': {'required': True}, + "cancellation_requested": {"required": True}, } _attribute_map = { - 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + "cancellation_requested": {"key": "cancellation_requested", "type": "bool"}, } - def __init__( - self, - *, - cancellation_requested: bool, - **kwargs - ): + def __init__(self, *, cancellation_requested: bool, **kwargs): """ - :keyword cancellation_requested: Required. Indicates if cancellation was requested on the - certificate operation. + :keyword cancellation_requested: Indicates if cancellation was requested on the certificate + operation. Required. :paramtype cancellation_requested: bool """ - super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + super().__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(msrest.serialization.Model): +class CertificatePolicy(_serialization.Model): """Management policy for a certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -918,28 +881,28 @@ class CertificatePolicy(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + key_properties: Optional["_models.KeyProperties"] = None, + secret_properties: Optional["_models.SecretProperties"] = None, + x509_certificate_properties: Optional["_models.X509CertificateProperties"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + issuer_parameters: Optional["_models.IssuerParameters"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, **kwargs ): """ @@ -957,7 +920,7 @@ def __init__( :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes """ - super(CertificatePolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.key_properties = key_properties self.secret_properties = secret_properties @@ -967,61 +930,56 @@ def __init__( self.attributes = attributes -class CertificateRestoreParameters(msrest.serialization.Model): +class CertificateRestoreParameters(_serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :ivar certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :ivar certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :vartype certificate_bundle_backup: bytes """ _validation = { - 'certificate_bundle_backup': {'required': True}, + "certificate_bundle_backup": {"required": True}, } _attribute_map = { - 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + "certificate_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - certificate_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, certificate_bundle_backup: bytes, **kwargs): """ - :keyword certificate_bundle_backup: Required. The backup blob associated with a certificate - bundle. + :keyword certificate_bundle_backup: The backup blob associated with a certificate bundle. + Required. :paramtype certificate_bundle_backup: bytes """ - super(CertificateRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(msrest.serialization.Model): +class CertificateUpdateParameters(_serialization.Model): """The certificate update parameters. :ivar certificate_policy: The management policy for the certificate. :vartype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar certificate_attributes: The attributes of the certificate (optional). :vartype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, - 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "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, + certificate_policy: Optional["_models.CertificatePolicy"] = None, + certificate_attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1030,16 +988,16 @@ def __init__( :paramtype certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :keyword certificate_attributes: The attributes of the certificate (optional). :paramtype certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(CertificateUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(msrest.serialization.Model): +class Contact(_serialization.Model): """The contact information for the vault certificates. :ivar email_address: Email address. @@ -1051,18 +1009,13 @@ class Contact(msrest.serialization.Model): """ _attribute_map = { - 'email_address': {'key': 'email', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, + "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 + self, *, email_address: Optional[str] = None, name: Optional[str] = None, phone: Optional[str] = None, **kwargs ): """ :keyword email_address: Email address. @@ -1072,13 +1025,13 @@ def __init__( :keyword phone: Phone number. :paramtype phone: str """ - super(Contact, self).__init__(**kwargs) + super().__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(msrest.serialization.Model): +class Contacts(_serialization.Model): """The contacts for the vault certificates. Variables are only populated by the server, and will be ignored when sending a request. @@ -1090,30 +1043,25 @@ class Contacts(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + "id": {"key": "id", "type": "str"}, + "contact_list": {"key": "contacts", "type": "[Contact]"}, } - def __init__( - self, - *, - contact_list: Optional[List["Contact"]] = None, - **kwargs - ): + def __init__(self, *, contact_list: Optional[List["_models.Contact"]] = None, **kwargs): """ :keyword contact_list: The contact list for the vault certificates. :paramtype contact_list: list[~azure.keyvault.v7_0.models.Contact] """ - super(Contacts, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.contact_list = contact_list -class DeletedCertificateBundle(CertificateBundle): +class DeletedCertificateBundle(CertificateBundle): # pylint: disable=too-many-instance-attributes """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. @@ -1129,12 +1077,12 @@ class DeletedCertificateBundle(CertificateBundle): :ivar policy: The management policy. :vartype policy: ~azure.keyvault.v7_0.models.CertificatePolicy :ivar cer: CER contents of x509 certificate. - :vartype cer: bytearray + :vartype cer: bytes :ivar content_type: The content type of the secret. :vartype content_type: str :ivar attributes: The certificate attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. @@ -1146,54 +1094,54 @@ class DeletedCertificateBundle(CertificateBundle): """ _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}, + "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'}, + "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, + cer: Optional[bytes] = None, content_type: Optional[str] = None, - attributes: Optional["CertificateAttributes"] = None, + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs ): """ :keyword cer: CER contents of x509 certificate. - :paramtype cer: bytearray + :paramtype cer: bytes :keyword content_type: The content type of the secret. :paramtype content_type: str :keyword attributes: The certificate attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted certificate. :paramtype recovery_id: str """ - super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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 @@ -1208,7 +1156,7 @@ class DeletedCertificateItem(CertificateItem): :vartype id: str :ivar attributes: The certificate management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar x509_thumbprint: Thumbprint of the certificate. :vartype x509_thumbprint: bytes @@ -1222,25 +1170,25 @@ class DeletedCertificateItem(CertificateItem): """ _validation = { - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, x509_thumbprint: Optional[bytes] = None, recovery_id: Optional[str] = None, @@ -1251,7 +1199,7 @@ def __init__( :paramtype id: str :keyword attributes: The certificate management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword x509_thumbprint: Thumbprint of the certificate. :paramtype x509_thumbprint: bytes @@ -1259,13 +1207,13 @@ def __init__( certificate. :paramtype recovery_id: str """ - super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + super().__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): +class DeletedCertificateListResult(_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. @@ -1278,27 +1226,23 @@ class DeletedCertificateListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedCertificateItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedCertificateListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(msrest.serialization.Model): +class KeyBundle(_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. @@ -1307,7 +1251,7 @@ class KeyBundle(msrest.serialization.Model): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1315,21 +1259,21 @@ class KeyBundle(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "key": {"key": "key", "type": "JsonWebKey"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1338,10 +1282,10 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.key = key self.attributes = attributes self.tags = tags @@ -1357,7 +1301,7 @@ class DeletedKeyBundle(KeyBundle): :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1372,26 +1316,26 @@ class DeletedKeyBundle(KeyBundle): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "managed": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, + "deleted_date": {"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'}, + "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"}, } def __init__( self, *, - key: Optional["JsonWebKey"] = None, - attributes: Optional["KeyAttributes"] = None, + key: Optional["_models.JsonWebKey"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1401,19 +1345,19 @@ def __init__( :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) + super().__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(msrest.serialization.Model): +class KeyItem(_serialization.Model): """The key item containing key metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1422,7 +1366,7 @@ class KeyItem(msrest.serialization.Model): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1430,21 +1374,21 @@ class KeyItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "managed": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + "kid": {"key": "kid", "type": "str"}, + "attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, + "managed": {"key": "managed", "type": "bool"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1453,10 +1397,10 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.attributes = attributes self.tags = tags @@ -1472,7 +1416,7 @@ class DeletedKeyItem(KeyItem): :vartype kid: str :ivar attributes: The key management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1487,26 +1431,26 @@ class DeletedKeyItem(KeyItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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"}, } def __init__( self, *, kid: Optional[str] = None, - attributes: Optional["KeyAttributes"] = None, + attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1516,19 +1460,19 @@ def __init__( :paramtype kid: str :keyword attributes: The key management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted key. :paramtype recovery_id: str """ - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) + super().__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(msrest.serialization.Model): +class DeletedKeyListResult(_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. @@ -1541,27 +1485,23 @@ class DeletedKeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedKeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedKeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionBundle(msrest.serialization.Model): +class SasDefinitionBundle(_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. @@ -1573,45 +1513,41 @@ class SasDefinitionBundle(msrest.serialization.Model): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _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}, + "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}'}, + "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}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionBundle, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.template_uri = None @@ -1633,15 +1569,15 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1653,48 +1589,43 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): """ _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}, + "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}, } _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'}, + "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"}, } - def __init__( - self, - *, - recovery_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SasDefinitionItem(msrest.serialization.Model): +class SasDefinitionItem(_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. @@ -1705,31 +1636,27 @@ class SasDefinitionItem(msrest.serialization.Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + "id": {"readonly": True}, + "secret_id": {"readonly": True}, + "attributes": {"readonly": True}, + "tags": {"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}'}, + "id": {"key": "id", "type": "str"}, + "secret_id": {"key": "sid", "type": "str"}, + "attributes": {"key": "attributes", "type": "SasDefinitionAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionItem, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.secret_id = None self.attributes = None @@ -1747,7 +1674,7 @@ class DeletedSasDefinitionItem(SasDefinitionItem): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. @@ -1759,42 +1686,37 @@ class DeletedSasDefinitionItem(SasDefinitionItem): """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "id": {"readonly": True}, + "secret_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'}, - '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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted SAS definition. :paramtype recovery_id: str """ - super(DeletedSasDefinitionItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSasDefinitionListResult(msrest.serialization.Model): +class DeletedSasDefinitionListResult(_serialization.Model): """The deleted SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -1807,27 +1729,23 @@ class DeletedSasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -1840,7 +1758,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1851,27 +1769,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1884,10 +1802,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -1910,7 +1828,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -1928,32 +1846,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -1967,19 +1885,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -1988,7 +1906,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -1998,22 +1916,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -2023,12 +1941,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -2045,7 +1963,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -2062,27 +1980,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -2093,7 +2011,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -2101,13 +2019,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2120,27 +2038,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageAccountItem(msrest.serialization.Model): +class StorageAccountItem(_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. @@ -2151,31 +2065,27 @@ class StorageAccountItem(msrest.serialization.Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.attributes = None @@ -2193,7 +2103,7 @@ class DeletedStorageAccountItem(StorageAccountItem): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2206,42 +2116,37 @@ class DeletedStorageAccountItem(StorageAccountItem): """ _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageAccountItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class StorageBundle(msrest.serialization.Model): +class StorageBundle(_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. @@ -2258,37 +2163,33 @@ class StorageBundle(msrest.serialization.Model): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :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}, + "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}'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.resource_id = None self.active_key_name = None @@ -2315,7 +2216,7 @@ class DeletedStorageBundle(StorageBundle): :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. @@ -2328,48 +2229,43 @@ class DeletedStorageBundle(StorageBundle): """ _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}, + "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'}, + "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: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_id: Optional[str] = None, **kwargs): """ :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted storage account. :paramtype recovery_id: str """ - super(DeletedStorageBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedStorageListResult(msrest.serialization.Model): +class DeletedStorageListResult(_serialization.Model): """The deleted storage account list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2382,27 +2278,23 @@ class DeletedStorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedStorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedStorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -2416,30 +2308,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(msrest.serialization.Model): +class IssuerAttributes(_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. @@ -2453,33 +2341,28 @@ class IssuerAttributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Determines whether the issuer is enabled. :paramtype enabled: bool """ - super(IssuerAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(msrest.serialization.Model): +class IssuerBundle(_serialization.Model): """The issuer for Key Vault certificate. Variables are only populated by the server, and will be ignored when sending a request. @@ -2497,24 +2380,24 @@ class IssuerBundle(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "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'}, + "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, + credentials: Optional["_models.IssuerCredentials"] = None, + organization_details: Optional["_models.OrganizationDetails"] = None, + attributes: Optional["_models.IssuerAttributes"] = None, **kwargs ): """ @@ -2527,7 +2410,7 @@ def __init__( :keyword attributes: Attributes of the issuer object. :paramtype attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ - super(IssuerBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.provider = provider self.credentials = credentials @@ -2535,7 +2418,7 @@ def __init__( self.attributes = attributes -class IssuerCredentials(msrest.serialization.Model): +class IssuerCredentials(_serialization.Model): """The credentials to be used for the certificate issuer. :ivar account_id: The user name/account name/account id. @@ -2545,29 +2428,23 @@ class IssuerCredentials(msrest.serialization.Model): """ _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, + "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 - ): + def __init__(self, *, account_id: Optional[str] = None, password: Optional[str] = None, **kwargs): """ :keyword account_id: The user name/account name/account id. :paramtype account_id: str :keyword password: The password/secret/account key. :paramtype password: str """ - super(IssuerCredentials, self).__init__(**kwargs) + super().__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(msrest.serialization.Model): +class IssuerParameters(_serialization.Model): """Parameters for the issuer of the X509 component of a certificate. :ivar name: Name of the referenced issuer object or reserved names; for example, 'Self' or @@ -2582,9 +2459,9 @@ class IssuerParameters(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + "name": {"key": "name", "type": "str"}, + "certificate_type": {"key": "cty", "type": "str"}, + "certificate_transparency": {"key": "cert_transparency", "type": "bool"}, } def __init__( @@ -2606,20 +2483,20 @@ def __init__( should be published to certificate transparency logs. :paramtype certificate_transparency: bool """ - super(IssuerParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class JsonWebKey(msrest.serialization.Model): +class JsonWebKey(_serialization.Model): # pylint: disable=too-many-instance-attributes """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :ivar kid: Key identifier. :vartype kid: str :ivar 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str] @@ -2643,8 +2520,8 @@ class JsonWebKey(msrest.serialization.Model): :vartype k: bytes :ivar t: HSM Token, used with 'Bring Your Own Key'. :vartype t: bytes - :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :ivar x: X component of an EC public key. :vartype x: bytes @@ -2653,29 +2530,29 @@ class JsonWebKey(msrest.serialization.Model): """ _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'}, + "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: Optional[str] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_ops: Optional[List[str]] = None, n: Optional[bytes] = None, e: Optional[bytes] = None, @@ -2687,7 +2564,7 @@ def __init__( q: Optional[bytes] = None, k: Optional[bytes] = None, t: Optional[bytes] = None, - crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + crv: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, x: Optional[bytes] = None, y: Optional[bytes] = None, **kwargs @@ -2696,8 +2573,8 @@ def __init__( :keyword kid: Key identifier. :paramtype kid: str :keyword 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". + https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str] @@ -2721,15 +2598,15 @@ def __init__( :paramtype k: bytes :keyword t: HSM Token, used with 'Bring Your Own Key'. :paramtype t: bytes - :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :paramtype crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :keyword x: X component of an EC public key. :paramtype x: bytes :keyword y: Y component of an EC public key. :paramtype y: bytes """ - super(JsonWebKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.kid = kid self.kty = kty self.key_ops = key_ops @@ -2765,26 +2642,26 @@ class KeyAttributes(Attributes): :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", + user; otherwise, only the system can purge the key, at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -2803,17 +2680,17 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(msrest.serialization.Model): +class KeyCreateParameters(_serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :ivar kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible - values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int @@ -2821,40 +2698,40 @@ class KeyCreateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True}, + "kty": {"required": True}, } _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'}, + "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: Union[str, "JsonWebKeyType"], + kty: Union[str, "_models.JsonWebKeyType"], key_size: Optional[int] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = 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, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ - :keyword kty: Required. The type of key to create. For valid values, see JsonWebKeyType. - Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword kty: The type of key to create. For valid values, see JsonWebKeyType. Required. Known + values are: "EC", "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int @@ -2862,13 +2739,13 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.kty = kty self.key_size = key_size self.key_ops = key_ops @@ -2877,59 +2754,59 @@ def __init__( self.curve = curve -class KeyImportParameters(msrest.serialization.Model): +class KeyImportParameters(_serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :ivar hsm: Whether to import as a hardware key (HSM) or software key. :vartype hsm: bool - :ivar key: Required. The Json web key. + :ivar key: The Json web key. Required. :vartype key: ~azure.keyvault.v7_0.models.JsonWebKey :ivar key_attributes: The key management attributes. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'key': {'required': True}, + "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}'}, + "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: "JsonWebKey", + key: "_models.JsonWebKey", hsm: Optional[bool] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword hsm: Whether to import as a hardware key (HSM) or software key. :paramtype hsm: bool - :keyword key: Required. The Json web key. + :keyword key: The Json web key. Required. :paramtype key: ~azure.keyvault.v7_0.models.JsonWebKey :keyword key_attributes: The key management attributes. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyImportParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.hsm = hsm self.key = key self.key_attributes = key_attributes self.tags = tags -class KeyListResult(msrest.serialization.Model): +class KeyListResult(_serialization.Model): """The key list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2942,27 +2819,23 @@ class KeyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[KeyItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(msrest.serialization.Model): +class KeyOperationResult(_serialization.Model): """The key operation result. Variables are only populated by the server, and will be ignored when sending a request. @@ -2974,117 +2847,107 @@ class KeyOperationResult(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, + "kid": {"readonly": True}, + "result": {"readonly": True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, + "kid": {"key": "kid", "type": "str"}, + "result": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyOperationResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(msrest.serialization.Model): +class KeyOperationsParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256", + and "RSA1_5". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :ivar value: Required. :vartype value: bytes """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"], value: bytes, **kwargs): """ - :keyword algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", - "RSA-OAEP-256", "RSA1_5". + :keyword algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", + "RSA-OAEP-256", and "RSA1_5". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeyOperationsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(msrest.serialization.Model): +class KeyProperties(_serialization.Model): """Properties of the key pair backing a certificate. :ivar exportable: Indicates if the private key can be exported. :vartype exportable: bool - :ivar key_type: The type of key pair to be used for the certificate. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :ivar key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :vartype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int :ivar reuse_key: Indicates if the same key pair will be used on certificate renewal. :vartype reuse_key: bool - :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values are: + "P-256", "P-384", "P-521", and "P-256K". :vartype curve: str or ~azure.keyvault.v7_0.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'}, + "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_type: Optional[Union[str, "_models.JsonWebKeyType"]] = None, key_size: Optional[int] = None, reuse_key: Optional[bool] = None, - curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword exportable: Indicates if the private key can be exported. :paramtype exportable: bool - :keyword key_type: The type of key pair to be used for the certificate. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :keyword key_type: The type of key pair to be used for the certificate. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM", and "oct". :paramtype key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int :keyword reuse_key: Indicates if the same key pair will be used on certificate renewal. :paramtype reuse_key: bool - :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values - include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Known values + are: "P-256", "P-384", "P-521", and "P-256K". :paramtype curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ - super(KeyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.exportable = exportable self.key_type = key_type self.key_size = key_size @@ -3092,45 +2955,40 @@ def __init__( self.curve = curve -class KeyRestoreParameters(msrest.serialization.Model): +class KeyRestoreParameters(_serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :ivar key_bundle_backup: Required. The backup blob associated with a key bundle. + :ivar key_bundle_backup: The backup blob associated with a key bundle. Required. :vartype key_bundle_backup: bytes """ _validation = { - 'key_bundle_backup': {'required': True}, + "key_bundle_backup": {"required": True}, } _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, + "key_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - key_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, key_bundle_backup: bytes, **kwargs): """ - :keyword key_bundle_backup: Required. The backup blob associated with a key bundle. + :keyword key_bundle_backup: The backup blob associated with a key bundle. Required. :paramtype key_bundle_backup: bytes """ - super(KeyRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(msrest.serialization.Model): +class KeySignParameters(_serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :ivar 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", + :ivar algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :ivar value: Required. @@ -3138,37 +2996,31 @@ class KeySignParameters(msrest.serialization.Model): """ _validation = { - 'algorithm': {'required': True}, - 'value': {'required': True}, + "algorithm": {"required": True}, + "value": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], - value: bytes, - **kwargs - ): + def __init__(self, *, algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], value: bytes, **kwargs): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and + "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :keyword value: Required. :paramtype value: bytes """ - super(KeySignParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(msrest.serialization.Model): +class KeyUpdateParameters(_serialization.Model): """The key update parameters. :ivar key_ops: Json web key operations. For more information on possible key operations, see @@ -3176,21 +3028,21 @@ class KeyUpdateParameters(msrest.serialization.Model): :vartype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :ivar key_attributes: The attributes of a key managed by the key vault service. :vartype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "key_ops": {"key": "key_ops", "type": "[str]"}, + "key_attributes": {"key": "attributes", "type": "KeyAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, - key_attributes: Optional["KeyAttributes"] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["_models.KeyAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3200,16 +3052,16 @@ def __init__( :paramtype key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] :keyword key_attributes: The attributes of a key managed by the key vault service. :paramtype key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(KeyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -3219,75 +3071,71 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None -class KeyVerifyParameters(msrest.serialization.Model): +class KeyVerifyParameters(_serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :ivar 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". + :ivar algorithm: The signing/verification algorithm. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", "PS384", "PS512", + "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :vartype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :ivar digest: Required. The digest used for signing. + :ivar digest: The digest used for signing. Required. :vartype digest: bytes - :ivar signature: Required. The signature to be verified. + :ivar signature: The signature to be verified. Required. :vartype signature: bytes """ _validation = { - 'algorithm': {'required': True}, - 'digest': {'required': True}, - 'signature': {'required': True}, + "algorithm": {"required": True}, + "digest": {"required": True}, + "signature": {"required": True}, } _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, + "algorithm": {"key": "alg", "type": "str"}, + "digest": {"key": "digest", "type": "base64"}, + "signature": {"key": "value", "type": "base64"}, } def __init__( self, *, - algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + algorithm: Union[str, "_models.JsonWebKeySignatureAlgorithm"], digest: bytes, signature: bytes, **kwargs ): """ - :keyword 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". + :keyword algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K". :paramtype algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm - :keyword digest: Required. The digest used for signing. + :keyword digest: The digest used for signing. Required. :paramtype digest: bytes - :keyword signature: Required. The signature to be verified. + :keyword signature: The signature to be verified. Required. :paramtype signature: bytes """ - super(KeyVerifyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(msrest.serialization.Model): +class KeyVerifyResult(_serialization.Model): """The key verify result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3297,24 +3145,20 @@ class KeyVerifyResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, + "value": {"key": "value", "type": "bool"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVerifyResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class LifetimeAction(msrest.serialization.Model): +class LifetimeAction(_serialization.Model): """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :ivar trigger: The condition that will execute the action. @@ -3324,16 +3168,12 @@ class LifetimeAction(msrest.serialization.Model): """ _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, + "trigger": {"key": "trigger", "type": "Trigger"}, + "action": {"key": "action", "type": "Action"}, } def __init__( - self, - *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, - **kwargs + self, *, trigger: Optional["_models.Trigger"] = None, action: Optional["_models.Action"] = None, **kwargs ): """ :keyword trigger: The condition that will execute the action. @@ -3341,12 +3181,12 @@ def __init__( :keyword action: The action that will be executed. :paramtype action: ~azure.keyvault.v7_0.models.Action """ - super(LifetimeAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(msrest.serialization.Model): +class OrganizationDetails(_serialization.Model): """Details of the organization of the certificate issuer. :ivar id: Id of the organization. @@ -3356,15 +3196,15 @@ class OrganizationDetails(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + "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, + id: Optional[str] = None, # pylint: disable=redefined-builtin + admin_details: Optional[List["_models.AdministratorDetails"]] = None, **kwargs ): """ @@ -3373,12 +3213,12 @@ def __init__( :keyword admin_details: Details of the organization administrator. :paramtype admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] """ - super(OrganizationDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(msrest.serialization.Model): +class PendingCertificateSigningRequestResult(_serialization.Model): """The pending certificate signing request result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3388,24 +3228,20 @@ class PendingCertificateSigningRequestResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SasDefinitionAttributes(msrest.serialization.Model): +class SasDefinitionAttributes(_serialization.Model): """The SAS definition management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3419,104 +3255,100 @@ class SasDefinitionAttributes(msrest.serialization.Model): :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", + definition, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(SasDefinitionAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class SasDefinitionCreateParameters(msrest.serialization.Model): +class SasDefinitionCreateParameters(_serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :ivar 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. + :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. + Required. :vartype template_uri: str - :ivar sas_type: Required. 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. Required. Known values + are: "account" and "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: Required. 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. Required. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'template_uri': {'required': True}, - 'sas_type': {'required': True}, - 'validity_period': {'required': True}, + "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}'}, + "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: Union[str, "SasTokenType"], + sas_type: Union[str, "_models.SasTokenType"], validity_period: str, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword 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. + :keyword 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. + Required. :paramtype template_uri: str - :keyword sas_type: Required. The type of SAS token the SAS definition will create. Possible - values include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Required. Known values + are: "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :keyword validity_period: Required. The validity period of SAS tokens created according to the - SAS definition. + :keyword validity_period: The validity period of SAS tokens created according to the SAS + definition. Required. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3524,7 +3356,7 @@ def __init__( self.tags = tags -class SasDefinitionListResult(msrest.serialization.Model): +class SasDefinitionListResult(_serialization.Model): """The storage account SAS definition list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3537,59 +3369,55 @@ class SasDefinitionListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SasDefinitionItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SasDefinitionListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(msrest.serialization.Model): +class SasDefinitionUpdateParameters(_serialization.Model): """The SAS definition update parameters. :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. Known values are: + "account" and "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. :vartype validity_period: str :ivar sas_definition_attributes: The attributes of the SAS definition. :vartype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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: Optional[str] = None, - sas_type: Optional[Union[str, "SasTokenType"]] = None, + sas_type: Optional[Union[str, "_models.SasTokenType"]] = None, validity_period: Optional[str] = None, - sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + sas_definition_attributes: Optional["_models.SasDefinitionAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3597,18 +3425,18 @@ def __init__( :keyword 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. :paramtype template_uri: str - :keyword sas_type: The type of SAS token the SAS definition will create. Possible values - include: "account", "service". + :keyword sas_type: The type of SAS token the SAS definition will create. Known values are: + "account" and "service". :paramtype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType :keyword validity_period: The validity period of SAS tokens created according to the SAS definition. :paramtype validity_period: str :keyword sas_definition_attributes: The attributes of the SAS definition. :paramtype sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type self.validity_period = validity_period @@ -3634,25 +3462,25 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "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"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } def __init__( @@ -3671,11 +3499,11 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -3688,27 +3516,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -3716,62 +3540,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -3780,14 +3594,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -3796,48 +3610,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3846,16 +3660,16 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(msrest.serialization.Model): +class StorageAccountAttributes(_serialization.Model): """The storage account management attributes. Variables are only populated by the server, and will be ignored when sending a request. @@ -3869,76 +3683,71 @@ class StorageAccountAttributes(msrest.serialization.Model): :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", + account, at the end of the retention interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", - "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", + "CustomizedRecoverable+Purgeable", "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "created": {"readonly": True}, + "updated": {"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'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "created": {"key": "created", "type": "unix-time"}, + "updated": {"key": "updated", "type": "unix-time"}, + "recovery_level": {"key": "recoveryLevel", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: the enabled state of the object. :paramtype enabled: bool """ - super(StorageAccountAttributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None self.recovery_level = None -class StorageAccountCreateParameters(msrest.serialization.Model): +class StorageAccountCreateParameters(_serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Storage account resource id. + :ivar resource_id: Storage account resource id. Required. :vartype resource_id: str - :ivar active_key_name: Required. Current active storage account key name. + :ivar active_key_name: Current active storage account key name. Required. :vartype active_key_name: str - :ivar auto_regenerate_key: Required. whether keyvault should manage the storage account for the - user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :vartype auto_regenerate_key: bool :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, + "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}'}, + "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__( @@ -3948,26 +3757,26 @@ def __init__( active_key_name: str, auto_regenerate_key: bool, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword resource_id: Required. Storage account resource id. + :keyword resource_id: Storage account resource id. Required. :paramtype resource_id: str - :keyword active_key_name: Required. Current active storage account key name. + :keyword active_key_name: Current active storage account key name. Required. :paramtype active_key_name: str - :keyword auto_regenerate_key: Required. whether keyvault should manage the storage account for - the user. + :keyword auto_regenerate_key: whether keyvault should manage the storage account for the user. + Required. :paramtype auto_regenerate_key: bool :keyword regeneration_period: The key regeneration time duration specified in ISO-8601 format. :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountCreateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3976,38 +3785,33 @@ def __init__( self.tags = tags -class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): +class StorageAccountRegenerteKeyParameters(_serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. - :ivar key_name: Required. The storage account key name. + :ivar key_name: The storage account key name. Required. :vartype key_name: str """ _validation = { - 'key_name': {'required': True}, + "key_name": {"required": True}, } _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, + "key_name": {"key": "keyName", "type": "str"}, } - def __init__( - self, - *, - key_name: str, - **kwargs - ): + def __init__(self, *, key_name: str, **kwargs): """ - :keyword key_name: Required. The storage account key name. + :keyword key_name: The storage account key name. Required. :paramtype key_name: str """ - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(msrest.serialization.Model): +class StorageAccountUpdateParameters(_serialization.Model): """The storage account update parameters. :ivar active_key_name: The current active storage account key name. @@ -4018,16 +3822,16 @@ class StorageAccountUpdateParameters(msrest.serialization.Model): :vartype regeneration_period: str :ivar storage_account_attributes: The attributes of the storage account. :vartype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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}'}, + "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__( @@ -4036,7 +3840,7 @@ def __init__( active_key_name: Optional[str] = None, auto_regenerate_key: Optional[bool] = None, regeneration_period: Optional[str] = None, - storage_account_attributes: Optional["StorageAccountAttributes"] = None, + storage_account_attributes: Optional["_models.StorageAccountAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -4049,10 +3853,10 @@ def __init__( :paramtype regeneration_period: str :keyword storage_account_attributes: The attributes of the storage account. :paramtype storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(StorageAccountUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key self.regeneration_period = regeneration_period @@ -4060,7 +3864,7 @@ def __init__( self.tags = tags -class StorageListResult(msrest.serialization.Model): +class StorageListResult(_serialization.Model): """The storage accounts list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -4073,58 +3877,49 @@ class StorageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageAccountItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class StorageRestoreParameters(msrest.serialization.Model): +class StorageRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar storage_bundle_backup: Required. The backup blob associated with a storage account. + :ivar storage_bundle_backup: The backup blob associated with a storage account. Required. :vartype storage_bundle_backup: bytes """ _validation = { - 'storage_bundle_backup': {'required': True}, + "storage_bundle_backup": {"required": True}, } _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, + "storage_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - storage_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, storage_bundle_backup: bytes, **kwargs): """ - :keyword storage_bundle_backup: Required. The backup blob associated with a storage account. + :keyword storage_bundle_backup: The backup blob associated with a storage account. Required. :paramtype storage_bundle_backup: bytes """ - super(StorageRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_bundle_backup = storage_bundle_backup -class SubjectAlternativeNames(msrest.serialization.Model): +class SubjectAlternativeNames(_serialization.Model): """The subject alternate names of a X509 object. :ivar emails: Email addresses. @@ -4136,9 +3931,9 @@ class SubjectAlternativeNames(msrest.serialization.Model): """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'dns_names': {'key': 'dns_names', 'type': '[str]'}, - 'upns': {'key': 'upns', 'type': '[str]'}, + "emails": {"key": "emails", "type": "[str]"}, + "dns_names": {"key": "dns_names", "type": "[str]"}, + "upns": {"key": "upns", "type": "[str]"}, } def __init__( @@ -4157,13 +3952,13 @@ def __init__( :keyword upns: User principal names. :paramtype upns: list[str] """ - super(SubjectAlternativeNames, self).__init__(**kwargs) + super().__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(msrest.serialization.Model): +class Trigger(_serialization.Model): """A condition to be satisfied for an action to be executed. :ivar lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between @@ -4176,20 +3971,16 @@ class Trigger(msrest.serialization.Model): """ _validation = { - 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + "lifetime_percentage": {"maximum": 99, "minimum": 1}, } _attribute_map = { - 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, - 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + "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 + self, *, lifetime_percentage: Optional[int] = None, days_before_expiry: Optional[int] = None, **kwargs ): """ :keyword lifetime_percentage: Percentage of lifetime at which to trigger. Value should be @@ -4200,12 +3991,12 @@ def __init__( between 1 and 972 (36 * 27). :paramtype days_before_expiry: int """ - super(Trigger, self).__init__(**kwargs) + super().__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(msrest.serialization.Model): +class X509CertificateProperties(_serialization.Model): """Properties of the X509 component of a certificate. :ivar subject: The subject name. Should be a valid X509 distinguished Name. @@ -4221,15 +4012,15 @@ class X509CertificateProperties(msrest.serialization.Model): """ _validation = { - 'validity_in_months': {'minimum': 0}, + "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'}, + "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__( @@ -4237,8 +4028,8 @@ def __init__( *, subject: Optional[str] = None, ekus: Optional[List[str]] = None, - subject_alternative_names: Optional["SubjectAlternativeNames"] = None, - key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + subject_alternative_names: Optional["_models.SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "_models.KeyUsageType"]]] = None, validity_in_months: Optional[int] = None, **kwargs ): @@ -4254,7 +4045,7 @@ def __init__( :keyword validity_in_months: The duration that the certificate is valid in months. :paramtype validity_in_months: int """ - super(X509CertificateProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.subject = subject self.ekus = ekus self.subject_alternative_names = subject_alternative_names diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_key_vault_client_operations.py index 5901a72a5eec..27aee6d86023 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_key_vault_client_operations.py @@ -6,2763 +6,2189 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_create_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/create") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "key-name": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_key_versions_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_key_versions_request(key_name: str, *, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/versions") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/backup") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_key_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_encrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_encrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/encrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_decrypt_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_decrypt_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/decrypt") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_sign_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sign_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/sign") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_verify_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_verify_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/verify") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_wrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_wrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/wrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_unwrap_key_request( - key_name, # type: str - key_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_unwrap_key_request(key_name: str, key_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/keys/{key-name}/{key-version}/unwrapkey") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), - "key-version": _SERIALIZER.url("key_version", key_version, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), + "key-version": _SERIALIZER.url("key_version", key_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_keys_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_key_request( - key_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_key_request(key_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedkeys/{key-name}/recover") path_format_arguments = { - "key-name": _SERIALIZER.url("key_name", key_name, 'str'), + "key-name": _SERIALIZER.url("key_name", key_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) +def build_get_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -def build_get_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_certificate_contacts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str +def build_delete_certificate_contacts_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/certificates/contacts") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuers_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_issuer_request( - issuer_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_issuer_request(issuer_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/issuers/{issuer-name}") path_format_arguments = { - "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, 'str'), + "issuer-name": _SERIALIZER.url("issuer_name", issuer_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/create") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_import_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_import_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/import") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_certificate_versions_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + certificate_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/versions") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_policy_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_policy_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/policy") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_request( - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_request(certificate_name: str, certificate_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/{certificate-version}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), + "certificate-version": _SERIALIZER.url("certificate_version", certificate_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_certificate_operation_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_certificate_operation_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_merge_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_merge_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/pending/merge") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/{certificate-name}/backup") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_certificate_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_certificate_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/certificates/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_certificates_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - include_pending = kwargs.pop('include_pending', None) # type: Optional[bool] - - accept = "application/json" + *, maxresults: Optional[int] = None, include_pending: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) if include_pending is not None: - _query_parameters['includePending'] = _SERIALIZER.query("include_pending", include_pending, 'bool') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["includePending"] = _SERIALIZER.query("include_pending", include_pending, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_certificate_request( - certificate_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_certificate_request(certificate_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedcertificates/{certificate-name}/recover") path_format_arguments = { - "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + "certificate-name": _SERIALIZER.url("certificate_name", certificate_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_accounts_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_accounts_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/backup") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_storage_account_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_storage_account_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_storage_account_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_storage_account_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_storage_account_key_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_storage_account_key_request(storage_account_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/regeneratekey") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definitions_request( - storage_account_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + storage_account_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_recover_deleted_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_sas_definition_request(storage_account_name: str, sas_definition_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_sas_definition_request( - storage_account_name, # type: str - sas_definition_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + storage_account_name: str, sas_definition_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/storage/{storage-account-name}/sas/{sas-definition-name}") path_format_arguments = { - "storage-account-name": _SERIALIZER.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - "sas-definition-name": _SERIALIZER.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + "storage-account-name": _SERIALIZER.url( + "storage_account_name", storage_account_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), + "sas-definition-name": _SERIALIZER.url( + "sas_definition_name", sas_definition_name, "str", pattern=r"^[0-9a-zA-Z]+$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): # pylint: disable=too-many-public-methods - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods + @overload def create_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. + new key. Required. :type key_name: str - :param parameters: The parameters to create a key. + :param parameters: The parameters to create a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def create_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def create_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyCreateParameters, IO], **kwargs: Any + ) -> _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. Required. + :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. Required. + :type key_name: str + :param parameters: The parameters to create a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyCreateParameters") request = build_create_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_key.metadata['url'], + content=_content, + template_url=self.create_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': "/keys/{key-name}/create"} # type: ignore + create_key.metadata = {"url": "/keys/{key-name}/create"} # type: ignore - - @distributed_trace + @overload def import_key( self, - vault_base_url, # type: str - key_name, # type: str - parameters, # type: "_models.KeyImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + parameters: _models.KeyImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyBundle: """Imports an externally created key, stores it, and returns key parameters and attributes to the client. @@ -2770,71 +2196,140 @@ def import_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: Name for the imported key. + :param key_name: Name for the imported key. Required. :type key_name: str - :param parameters: The parameters to import a key. + :param parameters: The parameters to import a key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def import_key( + self, + vault_base_url: str, + key_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def import_key( + self, vault_base_url: str, key_name: str, parameters: Union[_models.KeyImportParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: Name for the imported key. Required. + :type key_name: str + :param parameters: The parameters to import a key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyImportParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyImportParameters") request = build_import_key_request( key_name=key_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_key.metadata['url'], + content=_content, + template_url=self.import_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': "/keys/{key-name}"} # type: ignore - + import_key.metadata = {"url": "/keys/{key-name}"} # type: ignore @distributed_trace - def delete_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def delete_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -2842,67 +2337,141 @@ def delete_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the key to delete. + :param key_name: The name of the key to delete. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_delete_key_request( key_name=key_name, api_version=api_version, - template_url=self.delete_key.metadata['url'], + template_url=self.delete_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': "/keys/{key-name}"} # type: ignore + delete_key.metadata = {"url": "/keys/{key-name}"} # type: ignore + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of key to update. Required. + :type key_name: str + :param key_version: The version of the key to update. Required. + :type key_version: str + :param parameters: The parameters of the key to update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyUpdateParameters, IO], + **kwargs: Any + ) -> _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. @@ -2910,29 +2479,45 @@ def update_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of key to update. + :param key_name: The name of key to update. Required. :type key_name: str - :param key_version: The version of the key to update. + :param key_version: The version of the key to update. Required. :type key_version: str - :param parameters: The parameters of the key to update. - :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters + :param parameters: The parameters of the key to update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - _json = self._serialize.body(parameters, 'KeyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyUpdateParameters") request = build_update_key_request( key_name=key_name, @@ -2940,170 +2525,168 @@ def update_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_key.metadata['url'], + content=_content, + template_url=self.update_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + update_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace - def get_key( - self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def get_key(self, vault_base_url: str, key_name: str, key_version: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key to get. + :param key_name: The name of the key to get. Required. :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. + Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_get_key_request( key_name=key_name, key_version=key_version, api_version=api_version, - template_url=self.get_key.metadata['url'], + template_url=self.get_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': "/keys/{key-name}/{key-version}"} # type: ignore - + get_key.metadata = {"url": "/keys/{key-name}/{key-version}"} # type: ignore @distributed_trace def get_key_versions( - self, - vault_base_url, # type: str - key_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, key_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_key_versions_request( key_name=key_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_key_versions.metadata['url'], + api_version=api_version, + template_url=self.get_key_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_key_versions_request( - key_name=key_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3117,34 +2700,26 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': "/keys/{key-name}/versions"} # type: ignore + get_key_versions.metadata = {"url": "/keys/{key-name}/versions"} # type: ignore @distributed_trace def get_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.KeyItem"]: """List keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the @@ -3152,53 +2727,57 @@ def get_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either KeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_keys.metadata['url'], + api_version=api_version, + template_url=self.get_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3212,34 +2791,24 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': "/keys"} # type: ignore + get_keys.metadata = {"url": "/keys"} # type: ignore @distributed_trace - def backup_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupKeyResult" + def backup_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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 @@ -3254,65 +2823,71 @@ def backup_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: BackupKeyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupKeyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupKeyResult] - request = build_backup_key_request( key_name=key_name, api_version=api_version, - template_url=self.backup_key.metadata['url'], + template_url=self.backup_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupKeyResult', pipeline_response) + deserialized = self._deserialize("BackupKeyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': "/keys/{key-name}/backup"} # type: ignore + backup_key.metadata = {"url": "/keys/{key-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_key( self, - vault_base_url, # type: str - parameters, # type: "_models.KeyRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + vault_base_url: str, + parameters: _models.KeyRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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, @@ -3326,70 +2901,224 @@ def restore_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the key. + :param parameters: The parameters to restore the key. Required. :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyBundle, or the result of cls(response) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'KeyRestoreParameters') + @overload + def restore_key( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.KeyBundle: + """Restores a backed up key to a vault. - request = build_restore_key_request( - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.restore_key.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_key( + self, vault_base_url: str, parameters: Union[_models.KeyRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the key. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyRestoreParameters") + + request = build_restore_key_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.restore_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': "/keys/restore"} # type: ignore + restore_key.metadata = {"url": "/keys/restore"} # type: ignore + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the encryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def encrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3401,29 +3130,45 @@ def encrypt( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the encryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the encryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_encrypt_request( key_name=key_name, @@ -3431,46 +3176,120 @@ def encrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.encrypt.metadata['url'], + content=_content, + template_url=self.encrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + encrypt.metadata = {"url": "/keys/{key-name}/{key-version}/encrypt"} # type: ignore + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the decryption operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def decrypt( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _models.KeyOperationResult: """Decrypts a single block of encrypted data. The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption @@ -3480,29 +3299,45 @@ def decrypt( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the decryption operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the decryption operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_decrypt_request( key_name=key_name, @@ -3510,75 +3345,159 @@ def decrypt( api_version=api_version, content_type=content_type, json=_json, - template_url=self.decrypt.metadata['url'], + content=_content, + template_url=self.decrypt.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + decrypt.metadata = {"url": "/keys/{key-name}/{key-version}/decrypt"} # type: ignore + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeySignParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the signing operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def sign( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeySignParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeySignParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the signing operation. - :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters + :param parameters: The parameters for the signing operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeySignParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeySignParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeySignParameters") request = build_sign_request( key_name=key_name, @@ -3586,46 +3505,118 @@ def sign( api_version=api_version, content_type=content_type, json=_json, - template_url=self.sign.metadata['url'], + content=_content, + template_url=self.sign.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': "/keys/{key-name}/{key-version}/sign"} # type: ignore + sign.metadata = {"url": "/keys/{key-name}/{key-version}/sign"} # type: ignore + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyVerifyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for verify operations. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def verify( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyVerifyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyVerifyResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyVerifyParameters, IO], + **kwargs: Any + ) -> _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 @@ -3634,29 +3625,45 @@ def verify( 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. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for verify operations. - :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters + :param parameters: The parameters for verify operations. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyVerifyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyVerifyResult, or the result of cls(response) + :return: KeyVerifyResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyVerifyResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyVerifyResult] - _json = self._serialize.body(parameters, 'KeyVerifyParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyVerifyParameters") request = build_verify_request( key_name=key_name, @@ -3664,46 +3671,120 @@ def verify( api_version=api_version, content_type=content_type, json=_json, - template_url=self.verify.metadata['url'], + content=_content, + template_url=self.verify.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyVerifyResult', pipeline_response) + deserialized = self._deserialize("KeyVerifyResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': "/keys/{key-name}/{key-version}/verify"} # type: ignore + verify.metadata = {"url": "/keys/{key-name}/{key-version}/verify"} # type: ignore + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for wrap operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def wrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3713,29 +3794,45 @@ def wrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for wrap operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for wrap operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_wrap_key_request( key_name=key_name, @@ -3743,46 +3840,116 @@ def wrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.wrap_key.metadata['url'], + content=_content, + template_url=self.wrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + wrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/wrapkey"} # type: ignore + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: _models.KeyOperationsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param key_name: The name of the key. Required. + :type key_name: str + :param key_version: The version of the key. Required. + :type key_version: str + :param parameters: The parameters for the key operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ @distributed_trace def unwrap_key( self, - vault_base_url, # type: str - key_name, # type: str - key_version, # type: str - parameters, # type: "_models.KeyOperationsParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyOperationResult" + vault_base_url: str, + key_name: str, + key_version: str, + parameters: Union[_models.KeyOperationsParameters, IO], + **kwargs: Any + ) -> _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 @@ -3790,29 +3957,45 @@ def unwrap_key( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :type key_name: str - :param key_version: The version of the key. + :param key_version: The version of the key. Required. :type key_version: str - :param parameters: The parameters for the key operation. - :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters + :param parameters: The parameters for the key operation. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.KeyOperationsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: KeyOperationResult, or the result of cls(response) + :return: KeyOperationResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyOperationResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyOperationResult] - _json = self._serialize.body(parameters, 'KeyOperationsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "KeyOperationsParameters") request = build_unwrap_key_request( key_name=key_name, @@ -3820,44 +4003,41 @@ def unwrap_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.unwrap_key.metadata['url'], + content=_content, + template_url=self.unwrap_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyOperationResult', pipeline_response) + deserialized = self._deserialize("KeyOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore - + unwrap_key.metadata = {"url": "/keys/{key-name}/{key-version}/unwrapkey"} # type: ignore @distributed_trace def get_deleted_keys( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedKeyListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedKeyItem"]: """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 @@ -3866,54 +4046,57 @@ def get_deleted_keys( 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. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedKeyItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_keys_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_keys.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_keys.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_keys_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -3927,160 +4110,150 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': "/deletedkeys"} # type: ignore + get_deleted_keys.metadata = {"url": "/deletedkeys"} # type: ignore @distributed_trace - def get_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedKeyBundle" + def get_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: DeletedKeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedKeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedKeyBundle] - request = build_get_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.get_deleted_key.metadata['url'], + template_url=self.get_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) + deserialized = self._deserialize("DeletedKeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + get_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace def purge_deleted_key( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, key_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param key_name: The name of the key. + :param key_name: The name of the key. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.purge_deleted_key.metadata['url'], + template_url=self.purge_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_key.metadata = {'url': "/deletedkeys/{key-name}"} # type: ignore - + purge_deleted_key.metadata = {"url": "/deletedkeys/{key-name}"} # type: ignore @distributed_trace - def recover_deleted_key( - self, - vault_base_url, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KeyBundle" + def recover_deleted_key(self, vault_base_url: str, key_name: str, **kwargs: Any) -> _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. @@ -4088,232 +4261,393 @@ def recover_deleted_key( 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. Required. :type vault_base_url: str - :param key_name: The name of the deleted key. + :param key_name: The name of the deleted key. Required. :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) + :return: KeyBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.KeyBundle] - request = build_recover_deleted_key_request( key_name=key_name, api_version=api_version, - template_url=self.recover_deleted_key.metadata['url'], + template_url=self.recover_deleted_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('KeyBundle', pipeline_response) + deserialized = self._deserialize("KeyBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': "/deletedkeys/{key-name}/recover"} # type: ignore - + recover_deleted_key.metadata = {"url": "/deletedkeys/{key-name}/recover"} # type: ignore - @distributed_trace + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -4321,166 +4655,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4494,91 +4829,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4592,87 +4921,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -4686,361 +5010,416 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -5049,50 +5428,52 @@ def get_certificates( provisioned. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5106,340 +5487,394 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificates.metadata = {'url': "/certificates"} # type: ignore + get_certificates.metadata = {"url": "/certificates"} # type: ignore @distributed_trace def delete_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_delete_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate.metadata['url'], + template_url=self.delete_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + deserialized = self._deserialize("DeletedCertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': "/certificates/{certificate-name}"} # type: ignore + delete_certificate.metadata = {"url": "/certificates/{certificate-name}"} # type: ignore + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: _models.Contacts, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_contacts( + self, vault_base_url: str, contacts: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param contacts: The contacts for the key vault certificate. Required. + :type contacts: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.Contacts + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def set_certificate_contacts( - self, - vault_base_url, # type: str - contacts, # type: "_models.Contacts" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + self, vault_base_url: str, contacts: Union[_models.Contacts, IO], **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param contacts: The contacts for the key vault certificate. - :type contacts: ~azure.keyvault.v7_0.models.Contacts + :param contacts: The contacts for the key vault certificate. Is either a model type or a IO + type. Required. + :type contacts: ~azure.keyvault.v7_0.models.Contacts or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Contacts, or the result of cls(response) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - _json = self._serialize.body(contacts, 'Contacts') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contacts, (IO, bytes)): + _content = contacts + else: + _json = self._serialize.body(contacts, "Contacts") request = build_set_certificate_contacts_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_contacts.metadata['url'], + content=_content, + template_url=self.set_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + set_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def get_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def get_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_get_certificate_contacts_request( api_version=api_version, - template_url=self.get_certificate_contacts.metadata['url'], + template_url=self.get_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + get_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace - def delete_certificate_contacts( - self, - vault_base_url, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contacts" + def delete_certificate_contacts(self, vault_base_url: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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) + :return: Contacts or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Contacts"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Contacts] - request = build_delete_certificate_contacts_request( api_version=api_version, - template_url=self.delete_certificate_contacts.metadata['url'], + template_url=self.delete_certificate_contacts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Contacts', pipeline_response) + deserialized = self._deserialize("Contacts", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': "/certificates/contacts"} # type: ignore - + delete_certificate_contacts.metadata = {"url": "/certificates/contacts"} # type: ignore @distributed_trace def get_certificate_issuers( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateIssuerListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateIssuerItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either CertificateIssuerItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateIssuerListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateIssuerListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_issuers_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_issuers.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_issuers.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_issuers_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5453,377 +5888,662 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_issuers.metadata = {'url': "/certificates/issuers"} # type: ignore + get_certificate_issuers.metadata = {"url": "/certificates/issuers"} # type: ignore - @distributed_trace + @overload def set_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer set parameter. + :param parameter: Certificate issuer set parameter. Required. :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerSetParameters, IO], + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer set parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerSetParameters") request = build_set_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_certificate_issuer.metadata['url'], + content=_content, + template_url=self.set_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 + set_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: _models.CertificateIssuerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param issuer_name: The name of the issuer. Required. + :type issuer_name: str + :param parameter: Certificate issuer update parameter. Required. + :type parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.IssuerBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_issuer( self, - vault_base_url, # type: str - issuer_name, # type: str - parameter, # type: "_models.CertificateIssuerUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + vault_base_url: str, + issuer_name: str, + parameter: Union[_models.CertificateIssuerUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :type issuer_name: str - :param parameter: Certificate issuer update parameter. - :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters + :param parameter: Certificate issuer update parameter. Is either a model type or a IO type. + Required. + :type parameter: ~azure.keyvault.v7_0.models.CertificateIssuerUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IssuerBundle, or the result of cls(response) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - _json = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameter, (IO, bytes)): + _content = parameter + else: + _json = self._serialize.body(parameter, "CertificateIssuerUpdateParameters") request = build_update_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_issuer.metadata['url'], + content=_content, + template_url=self.update_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + update_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def get_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def get_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_get_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.get_certificate_issuer.metadata['url'], + template_url=self.get_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + 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 - + get_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore @distributed_trace - def delete_certificate_issuer( - self, - vault_base_url, # type: str - issuer_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IssuerBundle" + def delete_certificate_issuer(self, vault_base_url: str, issuer_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param issuer_name: The name of the issuer. + :param issuer_name: The name of the issuer. Required. :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) + :return: IssuerBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IssuerBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.IssuerBundle] - request = build_delete_certificate_issuer_request( issuer_name=issuer_name, api_version=api_version, - template_url=self.delete_certificate_issuer.metadata['url'], + template_url=self.delete_certificate_issuer.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('IssuerBundle', pipeline_response) + deserialized = self._deserialize("IssuerBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) - return deserialized + return deserialized + + delete_certificate_issuer.metadata = {"url": "/certificates/issuers/{issuer-name}"} # type: ignore + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CertificateOperation: + """Creates a new certificate. - delete_certificate_issuer.metadata = {'url': "/certificates/issuers/{issuer-name}"} # type: ignore + 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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to create a certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to create a certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters + :param parameters: The parameters to create a certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateCreateParameters") request = build_create_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_certificate.metadata['url'], + content=_content, + template_url=self.create_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + create_certificate.metadata = {"url": "/certificates/{certificate-name}/create"} # type: ignore + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateImportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to import the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def import_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateImportParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateImportParameters, IO], + **kwargs: Any + ) -> _models.CertificateBundle: """Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The @@ -5831,129 +6551,143 @@ def import_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to import the certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters + :param parameters: The parameters to import the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateImportParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateImportParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateImportParameters") request = build_import_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.import_certificate.metadata['url'], + content=_content, + template_url=self.import_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + import_certificate.metadata = {"url": "/certificates/{certificate-name}/import"} # type: ignore @distributed_trace 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"] + self, vault_base_url: str, certificate_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.CertificateItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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. Default value is None. :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_0.models.CertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CertificateItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_certificate_versions_request( certificate_name=certificate_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_certificate_versions.metadata['url'], + api_version=api_version, + template_url=self.get_certificate_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_certificate_versions_request( - certificate_name=certificate_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -5967,200 +6701,356 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_certificate_versions.metadata = {'url': "/certificates/{certificate-name}/versions"} # type: ignore + get_certificate_versions.metadata = {"url": "/certificates/{certificate-name}/versions"} # type: ignore @distributed_trace def get_certificate_policy( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificatePolicy" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] - request = build_get_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_policy.metadata['url'], + template_url=self.get_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + get_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: _models.CertificatePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. Required. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. Required. + :type certificate_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificatePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace 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" + vault_base_url: str, + certificate_name: str, + certificate_policy: Union[_models.CertificatePolicy, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_policy: The policy for the certificate. - :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_policy: The policy for the certificate. Is either a model type or a IO type. + Required. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificatePolicy, or the result of cls(response) + :return: CertificatePolicy or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificatePolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_policy, 'CertificatePolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificatePolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_policy, (IO, bytes)): + _content = certificate_policy + else: + _json = self._serialize.body(certificate_policy, "CertificatePolicy") request = build_update_certificate_policy_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_policy.metadata['url'], + content=_content, + template_url=self.update_certificate_policy.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificatePolicy', pipeline_response) + 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 + update_certificate_policy.metadata = {"url": "/certificates/{certificate-name}/policy"} # type: ignore + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. Required. + :type certificate_name: str + :param certificate_version: The version of the certificate. Required. + :type certificate_version: str + :param parameters: The parameters for certificate update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - parameters, # type: "_models.CertificateUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + certificate_version: str, + parameters: Union[_models.CertificateUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. Required. :type certificate_version: str - :param parameters: The parameters for certificate update. - :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters + :param parameters: The parameters for certificate update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateUpdateParameters") request = build_update_certificate_request( certificate_name=certificate_name, @@ -6168,518 +7058,738 @@ def update_certificate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate.metadata['url'], + content=_content, + template_url=self.update_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + update_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore @distributed_trace def get_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, certificate_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Required. :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. + not specified, the latest version of the certificate is returned. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_get_certificate_request( certificate_name=certificate_name, certificate_version=certificate_version, api_version=api_version, - template_url=self.get_certificate.metadata['url'], + template_url=self.get_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 + get_certificate.metadata = {"url": "/certificates/{certificate-name}/{certificate-version}"} # type: ignore + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: _models.CertificateOperationUpdateParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + certificate_operation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param certificate_operation: The certificate operation response. Required. + :type certificate_operation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_certificate_operation( self, - vault_base_url, # type: str - certificate_name, # type: str - certificate_operation, # type: "_models.CertificateOperationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + vault_base_url: str, + certificate_name: str, + certificate_operation: Union[_models.CertificateOperationUpdateParameter, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param certificate_operation: The certificate operation response. - :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter + :param certificate_operation: The certificate operation response. Is either a model type or a + IO type. Required. + :type certificate_operation: ~azure.keyvault.v7_0.models.CertificateOperationUpdateParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateOperation, or the result of cls(response) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_operation, (IO, bytes)): + _content = certificate_operation + else: + _json = self._serialize.body(certificate_operation, "CertificateOperationUpdateParameter") request = build_update_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_certificate_operation.metadata['url'], + content=_content, + template_url=self.update_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + update_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def get_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_get_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_certificate_operation.metadata['url'], + template_url=self.get_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 - + get_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore @distributed_trace def delete_certificate_operation( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateOperation" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: CertificateOperation or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateOperation"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateOperation] - request = build_delete_certificate_operation_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.delete_certificate_operation.metadata['url'], + template_url=self.delete_certificate_operation.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateOperation', pipeline_response) + 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 + delete_certificate_operation.metadata = {"url": "/certificates/{certificate-name}/pending"} # type: ignore + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: _models.CertificateMergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param certificate_name: The name of the certificate. Required. + :type certificate_name: str + :param parameters: The parameters to merge certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def merge_certificate( self, - vault_base_url, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateMergeParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + certificate_name: str, + parameters: Union[_models.CertificateMergeParameters, IO], + **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :type certificate_name: str - :param parameters: The parameters to merge certificate. - :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters + :param parameters: The parameters to merge certificate. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateMergeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - _json = self._serialize.body(parameters, 'CertificateMergeParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateMergeParameters") request = build_merge_certificate_request( certificate_name=certificate_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.merge_certificate.metadata['url'], + content=_content, + template_url=self.merge_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + merge_certificate.metadata = {"url": "/certificates/{certificate-name}/pending/merge"} # type: ignore @distributed_trace def backup_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupCertificateResult" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: BackupCertificateResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupCertificateResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupCertificateResult] - request = build_backup_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.backup_certificate.metadata['url'], + template_url=self.backup_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + 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 - + backup_certificate.metadata = {"url": "/certificates/{certificate-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_certificate( self, - vault_base_url, # type: str - parameters, # type: "_models.CertificateRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + vault_base_url: str, + parameters: _models.CertificateRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the certificate. + :param parameters: The parameters to restore the certificate. Required. :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_certificate( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_0.models.CertificateBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_certificate( + self, vault_base_url: str, parameters: Union[_models.CertificateRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the certificate. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.CertificateRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateBundle, or the result of cls(response) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'CertificateRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CertificateRestoreParameters") request = build_restore_certificate_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_certificate.metadata['url'], + content=_content, + template_url=self.restore_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + deserialized = self._deserialize("CertificateBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': "/certificates/restore"} # type: ignore - + restore_certificate.metadata = {"url": "/certificates/restore"} # type: ignore @distributed_trace 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"] + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DeletedCertificateItem"]: """Lists the deleted certificates in the specified vault currently available for recovery. The GetDeletedCertificates operation retrieves the certificates in the current vault which are @@ -6687,7 +7797,7 @@ def get_deleted_certificates( 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. @@ -6696,50 +7806,53 @@ def get_deleted_certificates( provisioned. Default value is None. :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 + :return: An iterator like instance of either DeletedCertificateItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_certificates_request( - api_version=api_version, maxresults=maxresults, include_pending=include_pending, - template_url=self.get_deleted_certificates.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_certificates.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_certificates_request( - api_version=api_version, - maxresults=maxresults, - include_pending=include_pending, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -6753,160 +7866,154 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_certificates.metadata = {'url': "/deletedcertificates"} # type: ignore + get_deleted_certificates.metadata = {"url": "/deletedcertificates"} # type: ignore @distributed_trace def get_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedCertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: DeletedCertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedCertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedCertificateBundle] - request = build_get_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.get_deleted_certificate.metadata['url'], + template_url=self.get_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + 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 - + get_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def purge_deleted_certificate( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param certificate_name: The name of the certificate. + :param certificate_name: The name of the certificate. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.purge_deleted_certificate.metadata['url'], + template_url=self.purge_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_certificate.metadata = {'url': "/deletedcertificates/{certificate-name}"} # type: ignore - + purge_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}"} # type: ignore @distributed_trace def recover_deleted_certificate( - self, - vault_base_url, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateBundle" + self, vault_base_url: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateBundle: """Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The @@ -6914,115 +8021,120 @@ def recover_deleted_certificate( 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. Required. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate. + :param certificate_name: The name of the deleted certificate. Required. :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) + :return: CertificateBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CertificateBundle] - request = build_recover_deleted_certificate_request( certificate_name=certificate_name, api_version=api_version, - template_url=self.recover_deleted_certificate.metadata['url'], + template_url=self.recover_deleted_certificate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CertificateBundle', pipeline_response) + 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 - + recover_deleted_certificate.metadata = {"url": "/deletedcertificates/{certificate-name}/recover"} # type: ignore @distributed_trace def get_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.StorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either StorageAccountItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7036,87 +8148,83 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': "/storage"} # type: ignore + get_storage_accounts.metadata = {"url": "/storage"} # type: ignore @distributed_trace def get_deleted_storage_accounts( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedStorageListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedStorageAccountItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedStorageAccountItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_storage_accounts_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_storage_accounts.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_storage_accounts.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_storage_accounts_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7130,740 +8238,1015 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': "/deletedstorage"} # type: ignore + get_deleted_storage_accounts.metadata = {"url": "/deletedstorage"} # type: ignore @distributed_trace def get_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_get_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_deleted_storage_account.metadata['url'], + template_url=self.get_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + get_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def purge_deleted_storage_account( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.purge_deleted_storage_account.metadata['url'], + template_url=self.purge_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}"} # type: ignore - + purge_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}"} # type: ignore @distributed_trace def recover_deleted_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_recover_deleted_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.recover_deleted_storage_account.metadata['url'], + template_url=self.recover_deleted_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': "/deletedstorage/{storage-account-name}/recover"} # type: ignore - + recover_deleted_storage_account.metadata = {"url": "/deletedstorage/{storage-account-name}/recover"} # type: ignore @distributed_trace def backup_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStorageResult" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: BackupStorageResult or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStorageResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStorageResult] - request = build_backup_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.backup_storage_account.metadata['url'], + template_url=self.backup_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStorageResult', pipeline_response) + deserialized = self._deserialize("BackupStorageResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': "/storage/{storage-account-name}/backup"} # type: ignore + backup_storage_account.metadata = {"url": "/storage/{storage-account-name}/backup"} # type: ignore - - @distributed_trace + @overload def restore_storage_account( self, - vault_base_url, # type: str - parameters, # type: "_models.StorageRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + parameters: _models.StorageRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the storage account. + :param parameters: The parameters to restore the storage account. Required. :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def restore_storage_account( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def restore_storage_account( + self, vault_base_url: str, parameters: Union[_models.StorageRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the storage account. Is either a model type or a + IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageRestoreParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageRestoreParameters") request = build_restore_storage_account_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_storage_account.metadata['url'], + content=_content, + template_url=self.restore_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': "/storage/restore"} # type: ignore - + restore_storage_account.metadata = {"url": "/storage/restore"} # type: ignore @distributed_trace def delete_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedStorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: DeletedStorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedStorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedStorageBundle] - request = build_delete_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.delete_storage_account.metadata['url'], + template_url=self.delete_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) + deserialized = self._deserialize("DeletedStorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore - + delete_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore @distributed_trace def get_storage_account( - self, - vault_base_url, # type: str - storage_account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + self, vault_base_url: str, storage_account_name: str, **kwargs: Any + ) -> _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. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - request = build_get_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, - template_url=self.get_storage_account.metadata['url'], + template_url=self.get_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + get_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to create a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to create a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters + :param parameters: The parameters to create a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountCreateParameters") request = build_set_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_storage_account.metadata['url'], + content=_content, + template_url=self.set_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + set_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to update a storage account. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_storage_account( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to update a storage account. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters + :param parameters: The parameters to update a storage account. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] - _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") request = build_update_storage_account_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_storage_account.metadata['url'], + content=_content, + template_url=self.update_storage_account.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': "/storage/{storage-account-name}"} # type: ignore + update_storage_account.metadata = {"url": "/storage/{storage-account-name}"} # type: ignore + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: _models.StorageAccountRegenerteKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param parameters: The parameters to regenerate storage account key. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def regenerate_storage_account_key( self, - vault_base_url, # type: str - storage_account_name, # type: str - parameters, # type: "_models.StorageAccountRegenerteKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageBundle" + vault_base_url: str, + storage_account_name: str, + parameters: Union[_models.StorageAccountRegenerteKeyParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param parameters: The parameters to regenerate storage account key. - :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters + :param parameters: The parameters to regenerate storage account key. Is either a model type or + a IO type. Required. + :type parameters: ~azure.keyvault.v7_0.models.StorageAccountRegenerteKeyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageBundle, or the result of cls(response) + :return: StorageBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StorageAccountRegenerteKeyParameters") request = build_regenerate_storage_account_key_request( storage_account_name=storage_account_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_storage_account_key.metadata['url'], + content=_content, + template_url=self.regenerate_storage_account_key.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('StorageBundle', pipeline_response) + deserialized = self._deserialize("StorageBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': "/storage/{storage-account-name}/regeneratekey"} # type: ignore - + regenerate_storage_account_key.metadata = {"url": "/storage/{storage-account-name}/regeneratekey"} # type: ignore @distributed_trace def get_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either SasDefinitionItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7877,93 +9260,86 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': "/storage/{storage-account-name}/sas"} # type: ignore + get_sas_definitions.metadata = {"url": "/storage/{storage-account-name}/sas"} # type: ignore @distributed_trace def get_deleted_sas_definitions( - self, - vault_base_url, # type: str - storage_account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSasDefinitionListResult"] + self, vault_base_url: str, storage_account_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSasDefinitionItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :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. Default value is None. :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 + :return: An iterator like instance of either DeletedSasDefinitionItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.0") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_sas_definitions_request( storage_account_name=storage_account_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_sas_definitions.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_sas_definitions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_sas_definitions_request( - storage_account_name=storage_account_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -7977,331 +9353,404 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': "/deletedstorage/{storage-account-name}/sas"} # type: ignore + get_deleted_sas_definitions.metadata = {"url": "/deletedstorage/{storage-account-name}/sas"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_get_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_deleted_sas_definition.metadata['url'], + template_url=self.get_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + get_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_recover_deleted_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.recover_deleted_sas_definition.metadata['url'], + template_url=self.recover_deleted_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore - + recover_deleted_sas_definition.metadata = {"url": "/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: DeletedSasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSasDefinitionBundle] - request = build_delete_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.delete_sas_definition.metadata['url'], + template_url=self.delete_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("DeletedSasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + delete_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore @distributed_trace 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" + self, vault_base_url: str, storage_account_name: str, sas_definition_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :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) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - request = build_get_sas_definition_request( storage_account_name=storage_account_name, sas_definition_name=sas_definition_name, api_version=api_version, - template_url=self.get_sas_definition.metadata['url'], + template_url=self.get_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + get_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to create a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def set_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionCreateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to create a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters + :param parameters: The parameters to create a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionCreateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionCreateParameters") request = build_set_sas_definition_request( storage_account_name=storage_account_name, @@ -8309,72 +9758,150 @@ def set_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_sas_definition.metadata['url'], + content=_content, + template_url=self.set_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + set_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: _models.SasDefinitionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. Required. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. Required. + :type sas_definition_name: str + :param parameters: The parameters to update a SAS definition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ @distributed_trace def update_sas_definition( self, - vault_base_url, # type: str - storage_account_name, # type: str - sas_definition_name, # type: str - parameters, # type: "_models.SasDefinitionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SasDefinitionBundle" + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Union[_models.SasDefinitionUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param storage_account_name: The name of the storage account. + :param storage_account_name: The name of the storage account. Required. :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. + :param sas_definition_name: The name of the SAS definition. Required. :type sas_definition_name: str - :param parameters: The parameters to update a SAS definition. - :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters + :param parameters: The parameters to update a SAS definition. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_0.models.SasDefinitionUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SasDefinitionBundle, or the result of cls(response) + :return: SasDefinitionBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SasDefinitionBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.0") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.0")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SasDefinitionBundle] - _json = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SasDefinitionUpdateParameters") request = build_update_sas_definition_request( storage_account_name=storage_account_name, @@ -8382,32 +9909,33 @@ def update_sas_definition( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_sas_definition.metadata['url'], + content=_content, + template_url=self.update_sas_definition.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) + deserialized = self._deserialize("SasDefinitionBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore - + update_sas_definition.metadata = {"url": "/storage/{storage-account-name}/sas/{sas-definition-name}"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_0/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_configuration.py index 565764479bb8..a260d72442e2 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_key_vault_client.py index ec9462870adf..ecf98c5501a0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_metadata.json b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_metadata.json index ba3298e2a787..c83079a7df7b 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_metadata.json +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,162 +65,174 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_1.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_1.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" }, "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: Any\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_1.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_1.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_1.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_1.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, maxresults" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_1.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_1.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 # type: (...) -\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_1.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_1.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_1.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters\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_1.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_1.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_vendor.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_configuration.py index 1972b53fa36f..74ea9479506a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", "7.1") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_key_vault_client.py index 51c1a20a5b25..278d02d53ecf 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.1". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_key_vault_client_operations.py index 68d5717f8566..aa12d1a4c3b4 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_key_vault_client_operations.py @@ -6,157 +6,325 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_secret_request, build_delete_secret_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_purge_deleted_secret_request, build_recover_deleted_secret_request, build_restore_secret_request, build_set_secret_request, build_update_secret_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_secret_request, + build_delete_secret_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_purge_deleted_secret_request, + build_recover_deleted_secret_request, + build_restore_secret_request, + build_set_secret_request, + build_update_secret_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -164,38 +332,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -203,164 +387,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_1.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -374,90 +561,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_1.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -471,87 +653,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_1.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -565,95 +742,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -661,241 +833,311 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/__init__.py index 7b3bf50e23cf..e9c5a4a5b527 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/__init__.py @@ -6,58 +6,44 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupSecretResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - from ._models_py3 import Error - from ._models_py3 import KeyVaultError - 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 -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupSecretResult # 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 KeyVaultError # 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_py3 import Attributes +from ._models_py3 import BackupSecretResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +from ._models_py3 import Error +from ._models_py3 import KeyVaultError +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 ._key_vault_client_enums import ( - DeletionRecoveryLevel, -) +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupSecretResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'KeyVaultError', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'DeletionRecoveryLevel', + "Attributes", + "BackupSecretResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "KeyVaultError", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "DeletionRecoveryLevel", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_key_vault_client_enums.py index 5e2d02bb006a..ded059738c1e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_key_vault_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -20,22 +19,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models.py deleted file mode 100644 index 79d0b8db059c..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models.py +++ /dev/null @@ -1,668 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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 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_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 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_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 SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype 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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models_py3.py index f77767215801..c5cb149f55e9 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,13 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, Optional +from typing import Dict, Optional, TYPE_CHECKING -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): + +class Attributes(_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. @@ -31,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -59,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -67,7 +71,7 @@ def __init__( self.updated = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -77,24 +81,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -107,7 +107,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -118,27 +118,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -151,10 +151,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -177,7 +177,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -195,32 +195,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -234,19 +234,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -255,7 +255,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -265,22 +265,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -290,12 +290,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -312,7 +312,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -329,27 +329,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -360,7 +360,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -368,13 +368,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -387,27 +387,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -421,30 +417,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -454,20 +446,16 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None @@ -492,27 +480,27 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -531,12 +519,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -549,27 +537,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -577,62 +561,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -641,14 +615,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -657,48 +631,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -707,10 +681,10 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_key_vault_client_operations.py index 258850dcb8a8..8d36fa9ee1bc 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_key_vault_client_operations.py @@ -6,607 +6,660 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -614,166 +667,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_1.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -787,91 +841,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_1.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -885,87 +933,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_1.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -979,342 +1022,398 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_1.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_1.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.1") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.1")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_1/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_configuration.py index 457e46a57cde..77b5afbd7fa5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_key_vault_client.py index 9fb22163b5ae..6981c3324ac4 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_metadata.json b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_metadata.json index 41fe13a36ecb..5d91e928dd39 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_metadata.json +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,162 +65,174 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_2.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_2.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" }, "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: Any\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_2.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_2.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_2.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_2.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, maxresults" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_2.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_2.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 # type: (...) -\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_2.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_2.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_2.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters\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_2.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_2.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_vendor.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_configuration.py index d7d9c414df27..3f6fb536e7ae 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", "7.2") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_key_vault_client.py index 2c20b19a9f0e..65170dfb8756 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_key_vault_client_operations.py index baf72d2d0475..168d19c6e4ad 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_key_vault_client_operations.py @@ -6,157 +6,325 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_secret_request, build_delete_secret_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_purge_deleted_secret_request, build_recover_deleted_secret_request, build_restore_secret_request, build_set_secret_request, build_update_secret_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_secret_request, + build_delete_secret_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_purge_deleted_secret_request, + build_recover_deleted_secret_request, + build_restore_secret_request, + build_set_secret_request, + build_update_secret_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -164,38 +332,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -203,164 +387,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_2.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -374,90 +561,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_2.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -471,87 +653,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_2.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -565,95 +742,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -661,241 +833,311 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/__init__.py index 7b3bf50e23cf..e9c5a4a5b527 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/__init__.py @@ -6,58 +6,44 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupSecretResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - from ._models_py3 import Error - from ._models_py3 import KeyVaultError - 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 -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupSecretResult # 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 KeyVaultError # 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_py3 import Attributes +from ._models_py3 import BackupSecretResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +from ._models_py3 import Error +from ._models_py3 import KeyVaultError +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 ._key_vault_client_enums import ( - DeletionRecoveryLevel, -) +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupSecretResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'KeyVaultError', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'DeletionRecoveryLevel', + "Attributes", + "BackupSecretResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "KeyVaultError", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "DeletionRecoveryLevel", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_key_vault_client_enums.py index 5e2d02bb006a..ded059738c1e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_key_vault_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -20,22 +19,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models.py deleted file mode 100644 index 12308726ef30..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models.py +++ /dev/null @@ -1,668 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_2.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 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 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 SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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_2.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_2.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models_py3.py index 97d592fb7210..64b8dcf2a283 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,13 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, Optional +from typing import Dict, Optional, TYPE_CHECKING -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): + +class Attributes(_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. @@ -31,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -59,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -67,7 +71,7 @@ def __init__( self.updated = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -77,24 +81,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -107,7 +107,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -118,27 +118,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -151,10 +151,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -177,7 +177,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -195,32 +195,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -234,19 +234,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -255,7 +255,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -265,22 +265,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -290,12 +290,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -312,7 +312,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -329,27 +329,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -360,7 +360,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -368,13 +368,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -387,27 +387,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -421,30 +417,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -454,20 +446,16 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None @@ -492,27 +480,27 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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__( @@ -531,12 +519,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -549,27 +537,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -577,62 +561,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -641,14 +615,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -657,48 +631,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -707,10 +681,10 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_2.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_key_vault_client_operations.py index 5ad93bdcece6..f8a1486f1e5c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_key_vault_client_operations.py @@ -6,607 +6,660 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -614,166 +667,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_2.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -787,91 +841,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_2.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -885,87 +933,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_2.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -979,342 +1022,398 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_2.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_2.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_2.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.2") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.2")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_2/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_configuration.py index 628918574705..801ab6cd733d 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_configuration.py @@ -6,52 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_key_vault_client.py index 0c65a11683de..5f9d522cc23a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_key_vault_client.py @@ -7,52 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class KeyVaultClient(KeyVaultClientOperationsMixin): +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - 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) + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -61,7 +52,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_metadata.json b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_metadata.json index 7e9876349b16..6e9dc415c50a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_metadata.json +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_metadata.json @@ -7,20 +7,32 @@ "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", "host_value": null, "parameterized_host_template": "\u0027{vaultBaseUrl}\u0027", - "azure_arm": false, + "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"KeyVaultClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"KeyVaultClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } }, "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } }, "constant": { }, - "call": "", + "call": "credential", "service_client_specific": { "sync": { "api_version": { @@ -53,162 +65,174 @@ } }, "config": { - "credential": false, - "credential_scopes": null, - "credential_call_sync": null, - "credential_call_async": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}" + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Optional\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", "operations": { "set_secret" : { "sync": { - "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n parameters, # type: \"_models.SecretSetParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: \"_models.SecretSetParameters\",\n **kwargs: Any\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 parameters: The parameters for setting the secret.\n:type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, parameters" + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n parameters: Union[_models.SecretSetParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param parameters: The parameters for setting the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_3.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 parameters, # type: \"_models.SecretUpdateParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: \"_models.SecretUpdateParameters\",\n **kwargs: Any\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 parameters: The parameters for update secret operation.\n:type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version, parameters" + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n parameters: Union[_models.SecretUpdateParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\n:type secret_name: str\n:param secret_version: The version of the secret. Required.\n:type secret_version: str\n:param parameters: The parameters for update secret operation. Is either a model type or a IO\n type. Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, parameters, **kwargs" + } }, "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 # type: (...) -\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" }, "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: Any\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, secret_version" + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Required.\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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, secret_version, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_3.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_3.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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_3.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" }, "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: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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_3.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name, maxresults" + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.SecretItem\"]:\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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. Default value is None.\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 SecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, maxresults, **kwargs" + } }, "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 # type: (...) -\u003e Iterable[\"_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. Default value is None.\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\n cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e Iterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" }, "async": { "coroutine": false, - "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_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. Default value is None.\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\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, maxresults" + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.DeletedSecretItem\"]:\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. Required.\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. Default value is None.\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 DeletedSecretItem or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, maxresults, **kwargs" + } }, "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 # type: (...) -\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_3.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_3.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.DeletedSecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "purge_deleted_secret" : { "sync": { - "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\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\"\"\"" + "signature": "def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" }, "async": { "coroutine": true, "signature": "async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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" + "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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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, **kwargs" + } }, "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 # type: (...) -\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret. Required.\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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "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 # type: (...) -\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_3.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" }, "async": { "coroutine": true, - "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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_3.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, secret_name" + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param secret_name: The name of the secret. Required.\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_3.models.BackupSecretResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, secret_name, **kwargs" + } }, "restore_secret" : { "sync": { - "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n parameters, # type: \"_models.SecretRestoreParameters\"\n **kwargs # type: Any\n):\n # type: (...) -\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" }, "async": { "coroutine": true, - "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: \"_models.SecretRestoreParameters\",\n **kwargs: Any\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 parameters: The parameters to restore the secret.\n:type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters\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_3.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "vault_base_url, parameters" + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n parameters: Union[_models.SecretRestoreParameters, IO],\n **kwargs: Any\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. Required.\n:type vault_base_url: str\n:param parameters: The parameters to restore the secret. Is either a model type or a IO type.\n Required.\n:type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: 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_3.models.SecretBundle\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "vault_base_url, parameters, **kwargs" + } } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_vendor.py index 138f663c53a4..f16bf024eaf5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_vendor.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/__init__.py index 110e223c2b43..265c1bc3d9bd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["KeyVaultClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_configuration.py index ebf0c448e109..d86cc427064c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_configuration.py @@ -6,46 +6,56 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential VERSION = "unknown" + class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for KeyVaultClient. Note that all parameters used to create this instance are saved as instance attributes. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", "7.3") # type: str + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + self.credential = credential self.api_version = api_version - kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + 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.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**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') + 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.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_key_vault_client.py index b4ee0991744f..a073964e9bdb 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_key_vault_client.py @@ -7,45 +7,43 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin -class KeyVaultClient(KeyVaultClientOperationsMixin): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - **kwargs: Any - ) -> None: - _base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{vaultBaseUrl}" + self._config = KeyVaultClientConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -54,7 +52,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_patch.py index 74e48ecd07cf..f7dd32510333 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_patch.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_patch.py @@ -1,31 +1,20 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_vendor.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_vendor.py new file mode 100644 index 000000000000..b2833693ffb6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import KeyVaultClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: KeyVaultClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_key_vault_client_operations.py index 807365117c5c..3b2057ee300d 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_key_vault_client_operations.py @@ -6,157 +6,325 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._key_vault_client_operations import build_backup_secret_request, build_delete_secret_request, build_get_deleted_secret_request, build_get_deleted_secrets_request, build_get_secret_request, build_get_secret_versions_request, build_get_secrets_request, build_purge_deleted_secret_request, build_recover_deleted_secret_request, build_restore_secret_request, build_set_secret_request, build_update_secret_request -T = TypeVar('T') +from ...operations._key_vault_client_operations import ( + build_backup_secret_request, + build_delete_secret_request, + build_get_deleted_secret_request, + build_get_deleted_secrets_request, + build_get_secret_request, + build_get_secret_versions_request, + build_get_secrets_request, + build_purge_deleted_secret_request, + build_recover_deleted_secret_request, + build_restore_secret_request, + build_set_secret_request, + build_update_secret_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class KeyVaultClientOperationsMixin: - @distributed_trace_async +class KeyVaultClientOperationsMixin(MixinABC): + @overload async def set_secret( self, vault_base_url: str, secret_name: str, - parameters: "_models.SecretSetParameters", + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - _json = self._serialize.body(parameters, 'SecretSetParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace_async - async def delete_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + async def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update_secret( @@ -164,38 +332,54 @@ async def update_secret( vault_base_url: str, secret_name: str, secret_version: str, - parameters: "_models.SecretUpdateParameters", + parameters: Union[_models.SecretUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -203,164 +387,167 @@ async def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace_async async def get_secret( - self, - vault_base_url: str, - secret_name: str, - secret_version: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -374,90 +561,85 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url: str, - secret_name: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -471,87 +653,82 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url: str, - maxresults: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeletedSecretListResult"]: + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -565,95 +742,90 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace_async async def get_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.DeletedSecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any + self, vault_base_url: str, secret_name: str, **kwargs: Any ) -> None: """Permanently deletes the specified secret. @@ -661,241 +833,311 @@ async def purge_deleted_secret( # pylint: disable=inconsistent-return-statement 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. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace_async async def recover_deleted_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.SecretBundle": + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace_async - async def backup_secret( - self, - vault_base_url: str, - secret_name: str, - **kwargs: Any - ) -> "_models.BackupSecretResult": + async def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace_async + @overload async def restore_secret( self, vault_base_url: str, - parameters: "_models.SecretRestoreParameters", + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.SecretBundle": + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/__init__.py index 7b3bf50e23cf..e9c5a4a5b527 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/__init__.py @@ -6,58 +6,44 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Attributes - from ._models_py3 import BackupSecretResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - from ._models_py3 import Error - from ._models_py3 import KeyVaultError - 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 -except (SyntaxError, ImportError): - from ._models import Attributes # type: ignore - from ._models import BackupSecretResult # 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 KeyVaultError # 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_py3 import Attributes +from ._models_py3 import BackupSecretResult +from ._models_py3 import DeletedSecretBundle +from ._models_py3 import DeletedSecretItem +from ._models_py3 import DeletedSecretListResult +from ._models_py3 import Error +from ._models_py3 import KeyVaultError +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 ._key_vault_client_enums import ( - DeletionRecoveryLevel, -) +from ._key_vault_client_enums import DeletionRecoveryLevel +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'Attributes', - 'BackupSecretResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'Error', - 'KeyVaultError', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', - 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'DeletionRecoveryLevel', + "Attributes", + "BackupSecretResult", + "DeletedSecretBundle", + "DeletedSecretItem", + "DeletedSecretListResult", + "Error", + "KeyVaultError", + "SecretAttributes", + "SecretBundle", + "SecretItem", + "SecretListResult", + "SecretProperties", + "SecretRestoreParameters", + "SecretSetParameters", + "SecretUpdateParameters", + "DeletionRecoveryLevel", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_key_vault_client_enums.py index 5e2d02bb006a..ded059738c1e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_key_vault_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -20,22 +19,22 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Denotes a vault state in which deletion is an irreversible operation, without the possibility #: for recovery. This level corresponds to no protection being available against a Delete #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). + #: or higher (vault, resource group, subscription etc.) PURGEABLE = "Purgeable" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. + #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" #: Denotes a vault state in which deletion is recoverable without the possibility for immediate #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. + #: System wil permanently delete it after 90 days, if not recovered RECOVERABLE = "Recoverable" #: Denotes a vault and subscription state in which deletion is recoverable within retention #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. + #: after 90 days, if not recovered RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models.py deleted file mode 100644 index 38137b914392..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models.py +++ /dev/null @@ -1,668 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - 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 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. - - :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 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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. - - :ivar value: The secret value. - :vartype value: str - :ivar id: The secret id. - :vartype id: str - :ivar content_type: The content type of the secret. - :vartype content_type: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword value: The secret value. - :paramtype value: str - :keyword id: The secret id. - :paramtype id: str - :keyword content_type: The content type of the secret. - :paramtype content_type: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - """ - 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. - - :ivar id: Secret identifier. - :vartype id: str - :ivar attributes: The secret management attributes. - :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype 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 - :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :vartype recovery_id: str - :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 = { - '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 - ): - """ - :keyword id: Secret identifier. - :paramtype id: str - :keyword attributes: The secret management attributes. - :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted - secret. - :paramtype recovery_id: str - """ - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -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. - - :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_3.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 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_3.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 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_3.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 SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Determines whether the object is enabled. - :vartype enabled: bool - :ivar not_before: Not before date in UTC. - :vartype not_before: ~datetime.datetime - :ivar expires: Expiry date in UTC. - :vartype 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 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_3.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 - ): - """ - :keyword enabled: Determines whether the object is enabled. - :paramtype enabled: bool - :keyword not_before: Not before date in UTC. - :paramtype not_before: ~datetime.datetime - :keyword expires: Expiry date in UTC. - :paramtype expires: ~datetime.datetime - """ - super(SecretAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class SecretListResult(msrest.serialization.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_3.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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretProperties(msrest.serialization.Model): - """Properties of the key backing a certificate. - - :ivar content_type: The media type (MIME type). - :vartype content_type: str - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword content_type: The media type (MIME type). - :paramtype content_type: str - """ - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - - -class SecretRestoreParameters(msrest.serialization.Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :vartype secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. - :paramtype secret_bundle_backup: bytes - """ - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] - - -class SecretSetParameters(msrest.serialization.Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The value of the secret. - :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_3.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 - ): - """ - :keyword value: Required. The value of the secret. - :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes - """ - super(SecretSetParameters, self).__init__(**kwargs) - 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(msrest.serialization.Model): - """The secret update parameters. - - :ivar content_type: Type of the secret value such as a password. - :vartype content_type: str - :ivar secret_attributes: The secret management attributes. - :vartype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. - :vartype 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 - ): - """ - :keyword content_type: Type of the secret value such as a password. - :paramtype content_type: str - :keyword secret_attributes: The secret management attributes. - :paramtype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - 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) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models_py3.py index d11942655bd8..73fb18bbe877 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,13 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, Optional +from typing import Dict, Optional, TYPE_CHECKING -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class Attributes(msrest.serialization.Model): + +class Attributes(_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. @@ -31,16 +35,16 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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__( @@ -59,7 +63,7 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(Attributes, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.not_before = not_before self.expires = expires @@ -67,7 +71,7 @@ def __init__( self.updated = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -77,24 +81,20 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. @@ -107,7 +107,7 @@ class SecretBundle(msrest.serialization.Model): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -118,27 +118,27 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -151,10 +151,10 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretBundle, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.id = id self.content_type = content_type @@ -177,7 +177,7 @@ class DeletedSecretBundle(SecretBundle): :vartype content_type: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype 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. @@ -195,32 +195,32 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, recovery_id: Optional[str] = None, **kwargs @@ -234,19 +234,19 @@ def __init__( :paramtype content_type: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted secret. :paramtype recovery_id: str """ - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.Model): """The secret item containing secret metadata. Variables are only populated by the server, and will be ignored when sending a request. @@ -255,7 +255,7 @@ class SecretItem(msrest.serialization.Model): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -265,22 +265,22 @@ class SecretItem(msrest.serialization.Model): """ _validation = { - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, **kwargs @@ -290,12 +290,12 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str """ - super(SecretItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.attributes = attributes self.tags = tags @@ -312,7 +312,7 @@ class DeletedSecretItem(SecretItem): :vartype id: str :ivar attributes: The secret management attributes. :vartype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -329,27 +329,27 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, recovery_id: Optional[str] = None, @@ -360,7 +360,7 @@ def __init__( :paramtype id: str :keyword attributes: The secret management attributes. :paramtype attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str @@ -368,13 +368,13 @@ def __init__( secret. :paramtype recovery_id: str """ - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -387,27 +387,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -421,30 +417,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -454,20 +446,16 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None @@ -492,27 +480,27 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "CustomizedRecoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.keyvault.v7_3.models.DeletionRecoveryLevel """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, + "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'}, + "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__( @@ -531,12 +519,12 @@ def __init__( :keyword expires: Expiry date in UTC. :paramtype expires: ~datetime.datetime """ - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -549,27 +537,23 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. :ivar content_type: The media type (MIME type). @@ -577,62 +561,52 @@ class SecretProperties(msrest.serialization.Model): """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - *, - content_type: Optional[str] = None, - **kwargs - ): + def __init__(self, *, content_type: Optional[str] = None, **kwargs): """ :keyword content_type: The media type (MIME type). :paramtype content_type: str """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :ivar secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - *, - secret_bundle_backup: bytes, - **kwargs - ): + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): """ - :keyword secret_bundle_backup: Required. The backup blob associated with a secret bundle. + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. :paramtype secret_bundle_backup: bytes """ - super(SecretRestoreParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. - :ivar value: Required. The value of the secret. + :ivar value: The value of the secret. Required. :vartype value: str - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] :ivar content_type: Type of the secret value such as a password. :vartype content_type: str @@ -641,14 +615,14 @@ class SecretSetParameters(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, + "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'}, + "value": {"key": "value", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, } def __init__( @@ -657,48 +631,48 @@ def __init__( value: str, tags: Optional[Dict[str, str]] = None, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ - :keyword value: Required. The value of the secret. + :keyword value: The value of the secret. Required. :paramtype value: str - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword content_type: Type of the secret value such as a password. :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes """ - super(SecretSetParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.tags = tags self.content_type = content_type self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_serialization.Model): """The secret update parameters. :ivar content_type: Type of the secret value such as a password. :vartype content_type: str :ivar secret_attributes: The secret management attributes. :vartype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. + :ivar tags: Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, content_type: Optional[str] = None, - secret_attributes: Optional["SecretAttributes"] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -707,10 +681,10 @@ def __init__( :paramtype content_type: str :keyword secret_attributes: The secret management attributes. :paramtype secret_attributes: ~azure.keyvault.v7_3.models.SecretAttributes - :keyword tags: A set of tags. Application specific metadata in the form of key-value pairs. + :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] """ - super(SecretUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/__init__.py index 44bfc9d07bb1..49b0ac3bcab0 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/__init__.py @@ -8,6 +8,12 @@ from ._key_vault_client_operations import KeyVaultClientOperationsMixin +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'KeyVaultClientOperationsMixin', + "KeyVaultClientOperationsMixin", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_key_vault_client_operations.py index ec08408b2fc2..b720dcebe110 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_key_vault_client_operations.py @@ -6,607 +6,660 @@ # 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 msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section +from ..._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_set_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_set_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str", pattern=r"^[0-9a-zA-Z-]+$"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secret_request( - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secret_request(secret_name: str, secret_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/{secret-version}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), - "secret-version": _SERIALIZER.url("secret_version", secret_version, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), + "secret-version": _SERIALIZER.url("secret_version", secret_version, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_secret_versions_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + secret_name: str, *, maxresults: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/versions") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - maxresults = kwargs.pop('maxresults', None) # type: Optional[int] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secrets_request(*, maxresults: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int", maximum=25, minimum=1) + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_purge_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_recover_deleted_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recover_deleted_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/deletedsecrets/{secret-name}/recover") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_backup_secret_request( - secret_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_secret_request(secret_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/{secret-name}/backup") path_format_arguments = { - "secret-name": _SERIALIZER.url("secret_name", secret_name, 'str'), + "secret-name": _SERIALIZER.url("secret_name", secret_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restore_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_secret_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/secrets/restore") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -# fmt: on -class KeyVaultClientOperationsMixin(object): - @distributed_trace +class KeyVaultClientOperationsMixin(MixinABC): + @overload def set_secret( self, - vault_base_url, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretSetParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + parameters: _models.SecretSetParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param parameters: The parameters for setting the secret. + :param parameters: The parameters for setting the secret. Required. :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_secret( + self, + vault_base_url: str, + secret_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_secret( + self, vault_base_url: str, secret_name: str, parameters: Union[_models.SecretSetParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: The parameters for setting the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretSetParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretSetParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretSetParameters") request = build_set_secret_request( secret_name=secret_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self.set_secret.metadata['url'], + content=_content, + template_url=self.set_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore - + set_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore @distributed_trace - def delete_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def delete_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_delete_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.delete_secret.metadata['url'], + template_url=self.delete_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': "/secrets/{secret-name}"} # type: ignore + delete_secret.metadata = {"url": "/secrets/{secret-name}"} # type: ignore + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: _models.SecretUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param secret_version: The version of the secret. Required. + :type secret_version: str + :param parameters: The parameters for update secret operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update_secret( self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - parameters, # type: "_models.SecretUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + secret_name: str, + secret_version: str, + parameters: Union[_models.SecretUpdateParameters, IO], + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. Required. :type secret_version: str - :param parameters: The parameters for update secret operation. - :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters + :param parameters: The parameters for update secret operation. Is either a model type or a IO + type. Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretUpdateParameters") request = build_update_secret_request( secret_name=secret_name, @@ -614,166 +667,167 @@ def update_secret( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_secret.metadata['url'], + content=_content, + template_url=self.update_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + update_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - secret_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + self, vault_base_url: str, secret_name: str, secret_version: str, **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. + specified, the latest version of the secret is returned. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_get_secret_request( secret_name=secret_name, secret_version=secret_version, api_version=api_version, - template_url=self.get_secret.metadata['url'], + template_url=self.get_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': "/secrets/{secret-name}/{secret-version}"} # type: ignore - + get_secret.metadata = {"url": "/secrets/{secret-name}/{secret-version}"} # type: ignore @distributed_trace def get_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -787,91 +841,85 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': "/secrets"} # type: ignore + get_secrets.metadata = {"url": "/secrets"} # type: ignore @distributed_trace def get_secret_versions( - self, - vault_base_url, # type: str - secret_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + self, vault_base_url: str, secret_name: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.SecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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. Default value is None. :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_3.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.SecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_secret_versions_request( secret_name=secret_name, - api_version=api_version, maxresults=maxresults, - template_url=self.get_secret_versions.metadata['url'], + api_version=api_version, + template_url=self.get_secret_versions.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_secret_versions_request( - secret_name=secret_name, - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -885,87 +933,82 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': "/secrets/{secret-name}/versions"} # type: ignore + get_secret_versions.metadata = {"url": "/secrets/{secret-name}/versions"} # type: ignore @distributed_trace def get_deleted_secrets( - self, - vault_base_url, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedSecretListResult"] + self, vault_base_url: str, maxresults: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeletedSecretItem"]: """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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :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. Default value is None. :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_3.models.DeletedSecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either DeletedSecretItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_3.models.DeletedSecretItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_get_deleted_secrets_request( - api_version=api_version, maxresults=maxresults, - template_url=self.get_deleted_secrets.metadata['url'], + api_version=api_version, + template_url=self.get_deleted_secrets.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - - request = build_get_deleted_secrets_request( - api_version=api_version, - maxresults=maxresults, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) path_format_arguments = { - "vaultBaseUrl": self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - 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), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore request.method = "GET" return request @@ -979,342 +1022,398 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': "/deletedsecrets"} # type: ignore + get_deleted_secrets.metadata = {"url": "/deletedsecrets"} # type: ignore @distributed_trace - def get_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedSecretBundle" + def get_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: DeletedSecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.DeletedSecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedSecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.DeletedSecretBundle] - request = build_get_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.get_deleted_secret.metadata['url'], + template_url=self.get_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) + deserialized = self._deserialize("DeletedSecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + get_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace def purge_deleted_secret( # pylint: disable=inconsistent-return-statements - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, vault_base_url: str, secret_name: str, **kwargs: Any + ) -> 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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.purge_deleted_secret.metadata['url'], + template_url=self.purge_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - purge_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}"} # type: ignore - + purge_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}"} # type: ignore @distributed_trace - def recover_deleted_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + def recover_deleted_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the deleted secret. + :param secret_name: The name of the deleted secret. Required. :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) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] - request = build_recover_deleted_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.recover_deleted_secret.metadata['url'], + template_url=self.recover_deleted_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': "/deletedsecrets/{secret-name}/recover"} # type: ignore - + recover_deleted_secret.metadata = {"url": "/deletedsecrets/{secret-name}/recover"} # type: ignore @distributed_trace - def backup_secret( - self, - vault_base_url, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupSecretResult" + def backup_secret(self, vault_base_url: str, secret_name: str, **kwargs: Any) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param secret_name: The name of the secret. + :param secret_name: The name of the secret. Required. :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) + :return: BackupSecretResult or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.BackupSecretResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupSecretResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupSecretResult] - request = build_backup_secret_request( secret_name=secret_name, api_version=api_version, - template_url=self.backup_secret.metadata['url'], + template_url=self.backup_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupSecretResult', pipeline_response) + deserialized = self._deserialize("BackupSecretResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': "/secrets/{secret-name}/backup"} # type: ignore - + backup_secret.metadata = {"url": "/secrets/{secret-name}/backup"} # type: ignore - @distributed_trace + @overload def restore_secret( self, - vault_base_url, # type: str - parameters, # type: "_models.SecretRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecretBundle" + vault_base_url: str, + parameters: _models.SecretRestoreParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _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. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. Required. :type vault_base_url: str - :param parameters: The parameters to restore the secret. + :param parameters: The parameters to restore the secret. Required. :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecretBundle, or the result of cls(response) + :return: SecretBundle or the result of cls(response) :rtype: ~azure.keyvault.v7_3.models.SecretBundle - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def restore_secret( + self, vault_base_url: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def restore_secret( + self, vault_base_url: str, parameters: Union[_models.SecretRestoreParameters, IO], **kwargs: Any + ) -> _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. Required. + :type vault_base_url: str + :param parameters: The parameters to restore the secret. Is either a model type or a IO type. + Required. + :type parameters: ~azure.keyvault.v7_3.models.SecretRestoreParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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_3.models.SecretBundle + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretBundle"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "7.3") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'SecretRestoreParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", "7.3")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretBundle] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SecretRestoreParameters") request = build_restore_secret_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.restore_secret.metadata['url'], + content=_content, + template_url=self.restore_secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) 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), } - request.url = self._client.format_url(request.url, **path_format_arguments) + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = 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.failsafe_deserialize(_models.KeyVaultError, pipeline_response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecretBundle', pipeline_response) + deserialized = self._deserialize("SecretBundle", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': "/secrets/restore"} # type: ignore - + restore_secret.metadata = {"url": "/secrets/restore"} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_patch.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v7_3/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated_models.py index d3310ca8a80a..744071b326e7 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated_models.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated_models.py @@ -1,26 +1,33 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # 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. # -------------------------------------------------------------------------- -# pylint: skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713) -from enum import Enum, EnumMeta -import msrest.serialization -from six import with_metaclass +import datetime +from typing import Dict, Optional, TYPE_CHECKING +from ._generated import _serialization -class Attributes(msrest.serialization.Model): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from ._generated import models as _models + + +class Attributes(_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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -28,31 +35,43 @@ class Attributes(msrest.serialization.Model): """ _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, + "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'}, + "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 = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires self.created = None self.updated = None -class BackupSecretResult(msrest.serialization.Model): +class BackupSecretResult(_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. @@ -62,36 +81,34 @@ class BackupSecretResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, + "value": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(BackupSecretResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class SecretBundle(msrest.serialization.Model): +class SecretBundle(_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. - :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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar value: The secret value. + :vartype value: str + :ivar id: The secret id. + :vartype id: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The secret management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 @@ -101,59 +118,76 @@ class SecretBundle(msrest.serialization.Model): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, + "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'}, + "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: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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) + """ + :keyword value: The secret value. + :paramtype value: str + :keyword id: The secret id. + :paramtype id: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The secret management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__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): - # pylint: disable=line-too-long """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: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar value: The secret value. + :vartype value: str + :ivar id: The secret id. + :vartype id: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The secret management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype 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 + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted secret. - :type recovery_id: str + :vartype recovery_id: str :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. @@ -161,74 +195,111 @@ class DeletedSecretBundle(SecretBundle): """ _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword value: The secret value. + :paramtype value: str + :keyword id: The secret id. + :paramtype id: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The secret management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. + :paramtype recovery_id: str + """ + super().__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(msrest.serialization.Model): +class SecretItem(_serialization.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: 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 id: Secret identifier. + :vartype id: str + :ivar attributes: The secret management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar content_type: Type of the secret value such as a password. + :vartype 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}, + "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'}, + "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: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, **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) + """ + :keyword id: Secret identifier. + :paramtype id: str + :keyword attributes: The secret management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword content_type: Type of the secret value such as a password. + :paramtype content_type: str + """ + super().__init__(**kwargs) + self.id = id + self.attributes = attributes + self.tags = tags + self.content_type = content_type self.managed = None @@ -237,20 +308,20 @@ class DeletedSecretItem(SecretItem): 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: 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 id: Secret identifier. + :vartype id: str + :ivar attributes: The secret management attributes. + :vartype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar content_type: Type of the secret value such as a password. + :vartype 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 + :ivar recovery_id: The url of the recovery object, used to identify and recover the deleted secret. - :type recovery_id: str + :vartype recovery_id: str :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. @@ -258,33 +329,52 @@ class DeletedSecretItem(SecretItem): """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + "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'}, + "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: Optional[str] = None, # pylint: disable=redefined-builtin + attributes: Optional["_models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + recovery_id: Optional[str] = None, **kwargs ): - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) + """ + :keyword id: Secret identifier. + :paramtype id: str + :keyword attributes: The secret management attributes. + :paramtype attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword content_type: Type of the secret value such as a password. + :paramtype content_type: str + :keyword recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. + :paramtype recovery_id: str + """ + super().__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(msrest.serialization.Model): +class DeletedSecretListResult(_serialization.Model): """The deleted secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -297,25 +387,23 @@ class DeletedSecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[DeletedSecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(DeletedSecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class Error(msrest.serialization.Model): +class Error(_serialization.Model): """The key vault server error. Variables are only populated by the server, and will be ignored when sending a request. @@ -329,28 +417,26 @@ class Error(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class KeyVaultError(msrest.serialization.Model): +class KeyVaultError(_serialization.Model): """The key vault error exception. Variables are only populated by the server, and will be ignored when sending a request. @@ -360,18 +446,16 @@ class KeyVaultError(msrest.serialization.Model): """ _validation = { - 'error': {'readonly': True}, + "error": {"readonly": True}, } _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, + "error": {"key": "error", "type": "Error"}, } - def __init__( - self, - **kwargs - ): - super(KeyVaultError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error = None @@ -380,12 +464,12 @@ class SecretAttributes(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 enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in UTC. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in UTC. + :vartype expires: ~datetime.datetime :ivar created: Creation time in UTC. :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. @@ -396,39 +480,51 @@ class SecretAttributes(Attributes): :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", + interval. Known values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", - "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + "CustomizedRecoverable", and "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}, + "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'}, + "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(SecretAttributes, self).__init__(**kwargs) + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in UTC. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in UTC. + :paramtype expires: ~datetime.datetime + """ + super().__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_serialization.Model): """The secret list result. Variables are only populated by the server, and will be ignored when sending a request. @@ -441,188 +537,154 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecretItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(SecretListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(msrest.serialization.Model): +class SecretProperties(_serialization.Model): """Properties of the key backing a certificate. - :param content_type: The media type (MIME type). - :type content_type: str + :ivar content_type: The media type (MIME type). + :vartype content_type: str """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, + "content_type": {"key": "contentType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(SecretProperties, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) + def __init__(self, *, content_type: Optional[str] = None, **kwargs): + """ + :keyword content_type: The media type (MIME type). + :paramtype content_type: str + """ + super().__init__(**kwargs) + self.content_type = content_type -class SecretRestoreParameters(msrest.serialization.Model): +class SecretRestoreParameters(_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. - :type secret_bundle_backup: bytes + :ivar secret_bundle_backup: The backup blob associated with a secret bundle. Required. + :vartype secret_bundle_backup: bytes """ _validation = { - 'secret_bundle_backup': {'required': True}, + "secret_bundle_backup": {"required": True}, } _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, + "secret_bundle_backup": {"key": "value", "type": "base64"}, } - def __init__( - self, - **kwargs - ): - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs['secret_bundle_backup'] + def __init__(self, *, secret_bundle_backup: bytes, **kwargs): + """ + :keyword secret_bundle_backup: The backup blob associated with a secret bundle. Required. + :paramtype secret_bundle_backup: bytes + """ + super().__init__(**kwargs) + self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(msrest.serialization.Model): +class SecretSetParameters(_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: 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.v7_1.models.SecretAttributes + :ivar value: The value of the secret. Required. + :vartype value: str + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + :ivar content_type: Type of the secret value such as a password. + :vartype content_type: str + :ivar secret_attributes: The secret management attributes. + :vartype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes """ _validation = { - 'value': {'required': True}, + "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'}, + "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: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): - super(SecretSetParameters, self).__init__(**kwargs) - 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) + """ + :keyword value: The value of the secret. Required. + :paramtype value: str + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + :keyword content_type: Type of the secret value such as a password. + :paramtype content_type: str + :keyword secret_attributes: The secret management attributes. + :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes + """ + super().__init__(**kwargs) + self.value = value + self.tags = tags + self.content_type = content_type + self.secret_attributes = secret_attributes -class SecretUpdateParameters(msrest.serialization.Model): +class SecretUpdateParameters(_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_1.models.SecretAttributes - :param tags: A set of tags. Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] + :ivar content_type: Type of the secret value such as a password. + :vartype content_type: str + :ivar secret_attributes: The secret management attributes. + :vartype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "content_type": {"key": "contentType", "type": "str"}, + "secret_attributes": {"key": "attributes", "type": "SecretAttributes"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, + *, + content_type: Optional[str] = None, + secret_attributes: Optional["_models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, **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 _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """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. - """ - - #: Denotes a vault state in which deletion is an irreversible operation, without the possibility - #: for recovery. This level corresponds to no protection being available against a Delete - #: operation; the data is irretrievably lost upon accepting a Delete operation at the entity level - #: or higher (vault, resource group, subscription etc.). - PURGEABLE = "Purgeable" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity - #: during the retention interval (90 days), unless a Purge operation is requested, or the - #: subscription is cancelled. System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted - #: entity during the retention interval(90 days) and while the subscription is still available. - #: System wil permanently delete it after 90 days, if not recovered. - RECOVERABLE = "Recoverable" - #: Denotes a vault and subscription state in which deletion is recoverable within retention - #: interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in - #: which the subscription itself cannot be permanently canceled. System wil permanently delete it - #: after 90 days, if not recovered. - RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" - #: Denotes a vault state in which deletion is recoverable, and which also permits immediate and - #: permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees - #: the recoverability of the deleted entity during the retention interval, unless a Purge - #: operation is requested, or the subscription is cancelled. - CUSTOMIZED_RECOVERABLE_PURGEABLE = "CustomizedRecoverable+Purgeable" - #: Denotes a vault state in which deletion is recoverable without the possibility for immediate - #: and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level - #: guarantees the recoverability of the deleted entity during the retention interval and while the - #: subscription is still available. - CUSTOMIZED_RECOVERABLE = "CustomizedRecoverable" - #: Denotes a vault and subscription state in which deletion is recoverable, immediate and - #: permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot - #: be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the - #: recoverability of the deleted entity during the retention interval, and also reflects the fact - #: that the subscription itself cannot be cancelled. - CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription" + :keyword content_type: Type of the secret value such as a password. + :paramtype content_type: str + :keyword secret_attributes: The secret management attributes. + :paramtype secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes + :keyword tags: Application specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.content_type = content_type + self.secret_attributes = secret_attributes + self.tags = tags diff --git a/sdk/keyvault/azure-keyvault-secrets/setup.py b/sdk/keyvault/azure-keyvault-secrets/setup.py index 54b0d9e76cb5..17e199e88626 100644 --- a/sdk/keyvault/azure-keyvault-secrets/setup.py +++ b/sdk/keyvault/azure-keyvault-secrets/setup.py @@ -67,8 +67,7 @@ ), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.20.0", - "msrest>=0.6.21", + "azure-core<2.0.0,>=1.24.0", "azure-common~=1.1", "six>=1.11.0", ],